// GET: ClientsOfCarWashViews/Details/5 public async Task <ActionResult> NewOrder(int?id, string body, int?Services, int?idOrderServices = null) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (idOrderServices != null) { TempData["OrderServices"] = idOrderServices; } if (Services == null) { return(RedirectToRoute(new { controller = "Order", action = "Index" })); } else if (Services != null) { TempData["typeServices"] = Services; } _orderServices.ClearListOrder(); OrderServices.idClient = id; OrderServices.body = body; var CustomerOrders = Mapper.Map <ClientsOfCarWashView>(await _services.GetId(id)); Price = Mapper.Map <IEnumerable <DetailingsView> >(await _detailings.Converter()); Price = Price.Where(x => x.mark == false); var tablePriceResult = Price.Where(x => x.IdTypeService == Services).OrderByDescending(x => x.sorting); var detailingsGrup = await _groupWashServices.GetIdAll(Services); ViewBag.Detailings = tablePriceResult; ViewBag.DetailingsGrup = detailingsGrup; if (CustomerOrders == null) { return(HttpNotFound()); } return(View(CustomerOrders)); }
//// GET: TireChangeService public async Task <ActionResult> CreateOrder(int IdClient, bool Error = false) { if (Error) { ViewBag.Error = Error; } var priceListTireFitting = Mapper.Map <IEnumerable <PriceListTireFittingView> >(await _priceListTireFitting.GetTableAll()); ClientsOfCarWashView clientList = Mapper.Map <ClientsOfCarWashView>(await _clientsOfCarWash.GetId(IdClient)); ViewBag.Client = clientList; ViewBag.TypeOfCars = Mapper.Map <IEnumerable <TypeOfCarsView> >(await _typeOfCars.GetTableAll()); ViewBag.PriceListTireFittingOne = priceListTireFitting.Where(x => x.TypeOfCarsId == (int)TypeOfCars.PassengerCar); ViewBag.PriceListTireFittingTwo = priceListTireFitting.Where(x => x.TypeOfCarsId == (int)TypeOfCars.CargoVehicle); ViewBag.PriceTireFittingAdditionalServices = Mapper.Map <IEnumerable <PriceListTireFittingAdditionalServicesView> >(await _priceTireFittingAdditionalServices.GetTableAll()); ViewBag.RadiusOne = priceListTireFitting.Where(r => r.TypeOfCarsId == (int)TypeOfCars.PassengerCar).GroupBy(x => x.TireRadiusId) .Select(y => new IdModels { idTireRadius = y.First().TireRadius.idTireRadius, radius = y.First().TireRadius.radius, id = y.First().idPriceListTireFitting }); ViewBag.RadiusTwo = priceListTireFitting.Where(r => r.TypeOfCarsId == (int)TypeOfCars.CargoVehicle).GroupBy(x => x.TireRadiusId) .Select(y => new IdModels { idTireRadius = y.First().TireRadius.idTireRadius, radius = y.First().TireRadius.radius, id = y.First().idPriceListTireFitting }); TempData.Keep("CreateOrder"); return(View()); }
public async Task <ActionResult> InfoOrderTireStorage(int?idOrder) { if (idOrder == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var order = Mapper.Map <OrderServicesCarWashView>(await _orderServicesCarWash.GetId(idOrder)); var tireStorage = Mapper.Map <TireStorageView>(await _tireStorage.GetOrderId(idOrder.Value)); if (tireStorage != null && tireStorage.RelatedOrders != null) { getAdditionalTireStorageServices = Mapper.Map <IEnumerable <AdditionalTireStorageServicesView> >(await _additionalTireStorageServices.GetOrderId(tireStorage.RelatedOrders.Value)); } var client = Mapper.Map <ClientsOfCarWashView>(await _clientsOfCarWash.GetId(order.IdClientsOfCarWash)); ViewBag.Order = order; ViewBag.AdditionalTireStorageServices = getAdditionalTireStorageServices; ViewBag.Client = client; DateTime dateClose = tireStorage.dateOfAdoption.Value; double? sum = 0; if (getAdditionalTireStorageServices != null) { sum = getAdditionalTireStorageServices.Sum(x => x.Price); } ViewBag.PaymentState = order.PaymentState; ViewBag.StatusOrder = order.StatusOrder; ViewBag.CloseDate = dateClose.AddMonths(tireStorage.storageFee.storageTime.Value); ViewBag.Sum = tireStorage.storageFee.amount + sum + tireStorage.serviceCostTirePackages; ViewBag.SumAdditional = sum + tireStorage.serviceCostTirePackages; if (tireStorage == null) { return(HttpNotFound()); } return(View(tireStorage)); }
public async Task RemoveCarClient(int clientId) { var clientCar = await _clientsOfCarWash.GetId(clientId); var clientInfo = await _clientInfo.ClienWhereId(clientCar.IdInfoClient.Value); int?carId = null; await _clientsOfCarWash.Delete(clientCar); foreach (var item in clientInfo) { if (carId == null) { carId = item.Id; } await _clientInfo.Delete(item); } }