Beispiel #1
0
        public IActionResult Add()
        {
            AddSaleModel model = new AddSaleModel();

            model.AllCars      = this.carService.GetAll();
            model.AllCustomers = this.customerService.GetAll(OrderType.Ascending);
            return(this.View(model));
        }
Beispiel #2
0
        public IActionResult Add()
        {
            AddSaleModel addSaleModel = new AddSaleModel();

            addSaleModel.Cars      = this.salesService.GetCarSaleModels();
            addSaleModel.Customers = this.salesService.GetCustomerSaleModels();

            return(this.View(addSaleModel));
        }
Beispiel #3
0
        public IActionResult Add(AddSaleModel addSaleModel)
        {
            this.simpleLoggerService.LogToDb(this.User.Identity.Name, LogType.Add, "Sales");

            if (this.ModelState.IsValid)
            {
                FinalizeSaleModel finalizeSaleModel = this.salesService.GetFinalizeSaleInfo(addSaleModel.CarId, addSaleModel.CustomerId, addSaleModel.Discount);

                return(this.RedirectToAction(nameof(ReviewSale), finalizeSaleModel));
            }

            addSaleModel.Cars      = this.salesService.GetCarSaleModels();
            addSaleModel.Customers = this.salesService.GetCustomerSaleModels();

            return(this.View(addSaleModel));
        }
Beispiel #4
0
        public IActionResult AddSale(AddSaleModel addSale)
        {
            int saleId = this.salesService.AddSale(addSale.CarId, addSale.CustomerId, addSale.Discount);

            return(this.Redirect($"/Sales/{saleId}"));
        }