示例#1
0
        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();
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }