TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
John Hammond
NA
16
8.8k
I want to return different views with if statement
May 6 2014 10:30 AM
In the below code when "Amount" and "Count" are selected together I return View("CountandSum", DATEROWS); but if just "Amount" or just "Count" I want to return View("Dailys", obj); but anytime I selected just "Amount" or "Count" is returns View("CountandSum", DATEROWS); so any help and ideas Thanks John
[HttpPost]
public ActionResult Dailys(Dailys obj)
{
List<string> result = new List<string>();
List<Transaction> Transactions = new List<Transaction>();
try
{
result = ReportAdmin.Validate(obj);
if (result.Count.Equals(0))
{
if (obj.SelectedDatatypes.Contains("Amount"))
Transactions = Repository.GetSums(obj);
if (obj.SelectedDatatypes.Contains("Count"))
Transactions.AddRange(Repository.GetCounts(obj));
Transactions = Transactions.OrderBy(trans => trans.PROCESS_DATE).ThenBy(trans => trans.DataType).ThenBy(trans => trans.OUTLET).ToList();
System.Data.DataTable DATEROWS = DATEROW.GetDATEROW(Transactions);
// if (obj.SelectedDatatypes.Contains("Percent"))
// Transactions = Repository.GetPercents(obj);
return View("CountandSum", DATEROWS);
}
else
{
ViewBag.Status = result;
return View("Dailys", obj);
}
}
catch (Exception ex)
{
result.Add(ex.Message);
ViewBag.Status = result;
return View("Index", obj);
}
}
Reply
Answers (
1
)
passing values to method
pdf report generation in c#