示例#1
0
        public async Task <List <UserOrderView> > GetAllUserOrders(string userId)
        {
            var userOrders = await _db.ServicesSummaries.Where(s => s.UserId == userId && !s.IsCompleted).OrderByDescending(s => s.DayOfWork).ToListAsync();

            var result = new List <UserOrderView>();

            foreach (var item in userOrders)
            {
                var serviceList = await _servicesLogic.GetServicesFromSummary(item.ServiceList);

                var userCar = await _carLogic.GetUserCar(item.UserCarId);

                result.Add(new UserOrderView(item.SummaryId, serviceList, item.TotalPrice, userCar, item.DayOfWork));
            }
            return(result);
        }
示例#2
0
        public async Task <ActionResult> RemoveCar(int?id)
        {
            try
            {
                var userId  = User.Identity.GetUserId();
                var carView = await _carLogic.StartRemoveUserCarOperation(id, userId);

                ViewBag.DeletedCarModel = await _carLogic.GetUserCar(id);

                return(PartialView("RemoveUserCarModalView", carView));
            }
            catch (ArgumentNullException)
            {
                return(RedirectToAction("Index", new { message = ManageMessageId.RemoveCarError }));
            }
            catch (NullReferenceException)
            {
                return(RedirectToAction("Index", new { message = ManageMessageId.RemoveCarError }));
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", new { message = ManageMessageId.RemoveCarError }));
            }
        }