public ActionResult GenerateBilling(GenerateBillingViewModel model) { if (ModelState.IsValid) { var start = DateTime.Parse(model.StartDateTime); var end = DateTime.Parse(model.EndDateTime); var billings = BillingHelper.GetBillingsGrouppedByParking(start, end); return(Json(new { Success = true, Content = RenderRazorViewToString("_BillingPartial", billings) })); } return(Json(new { Success = false, Content = RenderRazorViewToString("_GenerateBillingPartial", model) })); }
public ActionResult GenerateBilling(GenerateBillingViewModel model) { if (ModelState.IsValid) { var user = User.Identity.GetApplicationUser(); var localAdmin = BusinessManager.Instance.LocalManagers.FindAll().SingleOrDefault(l => l.Email == user.Email); var parking = BusinessManager.Instance.Parkings.FindAll().SingleOrDefault(p => p.LocalManager.CPF == localAdmin.CPF); var start = DateTime.Parse(model.StartDateTime); var end = DateTime.Parse(model.EndDateTime); var billings = BillingHelper.GetBillingsForParking(parking.CNPJ, start, end); return(Json(new { Success = true, Content = RenderRazorViewToString("_BillingPartial", billings) })); } return(Json(new { Success = false, Content = RenderRazorViewToString("_GenerateBillingPartial", model) })); }