示例#1
0
        public ActionResult Confirmation(AddSaleConfirmationVM model)
        {
            var session = this.Request.Cookies.Get("sessionId");

            if (session != null && AuthenticationManager.IsAuthenticated(session.Value))
            {
                return(this.View(model));
            }
            return(RedirectToAction("Login", "Users"));
        }
示例#2
0
        public AddSaleConfirmationVM MakeAddSaleConfirmationVm(AddSaleBM sale)
        {
            var result   = new AddSaleConfirmationVM();
            var customer = Contex.Customers.Find(int.Parse(sale.Customer));
            var car      = Contex.Cars.Find(int.Parse(sale.Car));
            var price    = car.Parts.Sum(x => x.Price).Value;

            if (customer.IsYoungDriver)
            {
                sale.Discount += 5;
            }
            result.Customer   = customer.Name;
            result.Car        = car.Make + " " + car.Model;
            result.Discount   = sale.Discount;
            result.CarPrice   = price.ToString();
            result.FinalPrice = (price * (100 - sale.Discount) / 100).ToString();

            return(result);
        }