public async Task <IActionResult> PutMenu([FromRoute] int id, [FromBody] Menu Menu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != Menu.IdMenu) { return(BadRequest()); } _context.Entry(Menu).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCommunityPost([FromRoute] string id, [FromBody] CommunityPost communityPost) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != communityPost.PostId) { return(BadRequest()); } _context.Entry(communityPost).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommunityPostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }