예제 #1
0
        public IActionResult UpdateCoffee(string coffeeName)
        {
            var model = new UpdateCoffeeViewModel();

            model.NewName = string.Empty;
            model.OldName = coffeeName;


            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> UpdatedCoffee(UpdateCoffeeViewModel coffee)
        {
            var model = new CoffeeDBO();

            model.Name        = coffee.Name;
            model.Description = coffee.Description;
            model.Price       = coffee.Price;
            model.ID          = coffee.ID;

            await _coffeeRepository.UpdateExistingCoffee(model);

            return(RedirectToAction("CoffeesMenu"));
        }
예제 #3
0
        public IActionResult UpdateCoffee(UpdateCoffeeViewModel model)
        {
            var dboCoffee = new CoffeeDBO();

            dboCoffee.Name        = model.NewName;
            dboCoffee.Price       = model.NewPrice;
            dboCoffee.Description = model.NewDescription;
            dboCoffee.ID          = model.ID;

            _coffeeRepository.UpdateSelectedCoffee(dboCoffee);

            return(RedirectToAction(nameof(Coffees)));
        }
예제 #4
0
        public IActionResult UpdatedCoffee(UpdateCoffeeViewModel model)
        {
            const string coffeeKey = "coffees";

            if (_memoryCache.TryGetValue(coffeeKey, out IList <Coffee> coffees))
            {
                foreach (var coffee in coffees)
                {
                    if (model.Id == coffee.Id)
                    {
                        coffee.Name = model.NewName;
                    }
                }
            }

            return(RedirectToAction(nameof(Coffees)));
        }
예제 #5
0
        public IActionResult UpdateCoffee(int coffeeID)
        {
            var model = new UpdateCoffeeViewModel();

            var currentCoffee = _coffeeRepository.SelectOneCoffee(coffeeID);


            model.NewName = string.Empty;
            model.OldName = currentCoffee.Name;

            model.NewDescription = string.Empty;
            model.OldDescription = currentCoffee.Description;

            model.NewPrice = default(int);
            model.OldPrice = currentCoffee.Price;

            model.ID = coffeeID;

            return(View(model));
        }
예제 #6
0
        public IActionResult UpdateCoffee()
        {
            var model = new UpdateCoffeeViewModel();

            return(View(model));
        }