public ActionResult TransactionHistory(int?id) { if (id == null) { string name = HttpContext.User.Identity.Name; id = AgroExpressDBAccess.GetCustomerIdByUserId(name); if (id == 0) { return(RedirectToAction("ResourceNotFound", "Home")); } } var customer = AgroExpressDBAccess.GetCustomerByID((int)id); if (customer != null) { List <CustomerTransactionDetails> li = new List <CustomerTransactionDetails>(); CustomerTransactionDate tem = new CustomerTransactionDate(); tem.ID = customer.PKCustomerId; tem.Name = customer.FullName; tem.transactiondetails = li; tem.EndDate = DateTime.Now.AddDays(1).Date; tem.StartDate = tem.EndDate.AddDays(-30); var cus = AgroExpressDBAccess.GetCustomerTransectionHistory(tem.StartDate, tem.EndDate, (int)id); List <CustomerTransactionDetails> transactions = new List <CustomerTransactionDetails>(); tem.transactiondetails = cus; return(View(tem)); } return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult TransactionHistory(DateTime StartDate, DateTime EndDate, int ID) { var customer = AgroExpressDBAccess.GetCustomerByID(ID); if (customer != null) { List <CustomerTransactionDetails> li = new List <CustomerTransactionDetails>(); CustomerTransactionDate tem = new CustomerTransactionDate(); tem.ID = customer.PKCustomerId; tem.Name = customer.FullName; tem.transactiondetails = li; tem.EndDate = EndDate; tem.StartDate = StartDate; var cus = AgroExpressDBAccess.GetCustomerTransectionHistory(tem.StartDate, tem.EndDate.AddDays(1).Date, ID); List <CustomerTransactionDetails> transactions = new List <CustomerTransactionDetails>(); tem.transactiondetails = cus; return(View(tem)); } return(Redirect(Request.UrlReferrer.ToString())); }