public ServicesSummaryView GetServicesSummaryView(IEnumerable <Service> shopCart, int totalPrice) { var view = new ServicesSummaryView() { ServicesList = shopCart, TotalPrice = totalPrice }; return(view); }
public async Task <ActionResult> GetServiceSummary(ServicesSummaryView summary, Cart cart) { var userId = User.Identity.GetUserId(); if (ModelState.IsValid) { ServicesSummary servicesSummary = new ServicesSummary() { DateOfCreating = DateTime.Now, DayOfWork = summary.selectedDateTime, TotalPrice = summary.TotalPrice, UserCarId = summary.CarId, UserId = userId, ServiceList = _serviceLogic.ServicesToString(cart.Lines.ToList()) }; await _summariesLogic.AddNewSummary(servicesSummary); cart.Clear(); return(RedirectToAction("Index", new { message = SystemMessages.orderCreateSuccess })); } return(RedirectToAction("Index", new { message = SystemMessages.Error })); }