public IActionResult UpdateCoffee(string coffeeName) { var model = new UpdateCoffeeViewModel(); model.NewName = string.Empty; model.OldName = coffeeName; return(View(model)); }
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")); }
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))); }
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))); }
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)); }
public IActionResult UpdateCoffee() { var model = new UpdateCoffeeViewModel(); return(View(model)); }