예제 #1
0
        public async Task <IActionResult> PutCat(long id, Cat cat)
        {
            if (id != cat.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CatExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Owner> > PostOwner(Owner owner)
        {
            _context.Owners.Add(owner);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOwner", new { id = owner.Id }, owner));
        }