Example #1
0
        public async Task <User> AddUser(User user)
        {
            _context.Add(user);
            await _context.SaveChangesAsync();

            return(user);
        }
Example #2
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());
        }