public void OnPostProcessSales(DateTime salesdate, bool IsMonth) { if (!ModelState.IsValid) { ViewData["msg"] = "Invalid Inputs: Select Date and Shop "; return; } if (TempData["allShopsInSession"] != null) { allShops = ComplexTypeSerializerHelper.DeserializeObject <SelectListItem>(TempData["allShopsInSession"].ToString()); } else { allShops = shopRepo.GetAll().Select(s => new SelectListItem() { Text = s.ShopName, Value = s.Id.ToString() }).ToList(); } if (allShops != null) { if (IsMonth.Equals(false)) { Result = accountRepo.GetTotalSales_day(salesdate, shopId); ViewData["Result"] = Result; } else { Result = accountRepo.GetTotalSales_month(salesdate, shopId); ViewData["Result"] = Result; } } }
public void OnGet() { allShops = shopRepo.GetAll().Select(s => new SelectListItem() { Text = s.ShopName, Value = s.Id.ToString() }).ToList(); if (allShops != null) { var allShopsInSession = ComplexTypeSerializerHelper.SerializeObject <SelectListItem>(allShops); TempData["allShopsInSession"] = allShopsInSession; if (ViewData["Result"] != null) { Result = Convert.ToDecimal(ViewData["Result"]); } ViewData["Result"] = null; } }