Пример #1
0
        public ActionResult Save(PriceViewModel model)
        {
            var price = model.ToPrice();

            price.Id = model.Id;
            BusinessManager.Instance.Prices.Update(price);

            var prices = GetParkingFromCurrentLocalAdmin().Prices;

            return View("Manage", prices);
        }
Пример #2
0
        public ActionResult Add(PriceViewModel model)
        {
            var parking = GetParkingFromCurrentLocalAdmin();
            var price = model.ToPrice();

            price.Parking = parking;

            try
            {
                BusinessManager.Instance.Prices.Add(price);
            }
            catch (UniqueKeyViolationException)
            {
                ModelState.AddModelError("", "Já existe um preço nesse intervalo de horário");
                return View(model);
            }
            var prices = GetParkingFromCurrentLocalAdmin().Prices;
            return View("Manage", prices);
        }