public Cake Edit(int id, CreateCake createCake) { Cake cake = FindbyId(id); if (cake == null) { return(null); } cake.Id = id; cake.Name = createCake.Name; cake.Detailes = createCake.Detailes; cake.Amount = createCake.Amount; return(_cakeRepo.Update(cake)); }
public IActionResult Edit(int id, CreateCake CreateCake) { Cake cake = _cakeService.FindbyId(id); if (cake == null) { return(RedirectToAction(nameof(Index))); } if (ModelState.IsValid) { _cakeService.Edit(id, CreateCake); return(RedirectToAction(nameof(Detailes), new { id = id })); } EditCake editCake = new EditCake(id, CreateCake); return(View(editCake)); }
public Cake Create(CreateCake createCake) { return(_cakeRepo.Create(createCake)); }