public async Task Put(Guid id, [FromBody] string content) { var message = await _dbContext.Messages.FindAsync(id); message.Content = content; _dbContext.Update(message); await _dbContext.SaveChangesAsync(); }
public IActionResult Put([FromBody] Message message) { if (message == null) { return(BadRequest()); } if (!db.MessagesNew.Any(x => x.Id == message.Id)) { return(NotFound()); } db.Update(message); db.SaveChanges(); return(Ok(message)); }
public async Task <ActionResult <Message> > Put(Message message) { if (message == null) { return(BadRequest()); } if (!db.Messages.Any(x => x.Id == message.Id)) { return(NotFound()); } db.Update(message); await db.SaveChangesAsync(); return(Ok(message)); }