示例#1
0
        public async Task <IActionResult> PutIdea(string id, Idea idea)
        {
            if (id != idea.Id)
            {
                return(BadRequest());
            }

            _context.Entry(idea).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(Conflict());
            }

            return(NoContent());
        }
示例#2
0
 public async Task UpdateAsync(User userUpdates)
 {
     _context.Users.Attach(userUpdates);
     _context.Entry(userUpdates).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }