예제 #1
0
        public ServicesSummaryView GetServicesSummaryView(IEnumerable <Service> shopCart, int totalPrice)
        {
            var view = new ServicesSummaryView()
            {
                ServicesList = shopCart,
                TotalPrice   = totalPrice
            };

            return(view);
        }
예제 #2
0
        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 }));
        }