public ActionResult <MenuItemReadDto> UpdateTable(int id, [FromBody] MenuItemUpdateDto tableUpdateDto) { var tableModelFromRepo = _tableRepo.GetElementById(id); if (tableModelFromRepo == null) { return(NotFound()); } _mapper.Map(tableUpdateDto, tableModelFromRepo); _tableRepo.UpdateTable(tableModelFromRepo); _tableRepo.SaveChanges(); return(NoContent()); }
public ActionResult <MenuItemReadDto> UpdateMenuItem(int id, [FromBody] MenuItemUpdateDto menuItemUpdateDto) { var menuItemModelFromRepo = _menuItemRepo.GetElementById(id); if (menuItemModelFromRepo == null) { return(NotFound()); } _mapper.Map(menuItemUpdateDto, menuItemModelFromRepo); _menuItemRepo.UpdateMenuItem(menuItemModelFromRepo); _menuItemRepo.SaveChanges(); return(NoContent()); }