Exemplo n.º 1
0
        public async Task <ActionResult <ShoppingFacility> > PostShoppingFacility(ShoppingFacility shoppingFacility)
        {
            _context.ShoppingFacility.Add(shoppingFacility);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetShoppingFacility", new { id = shoppingFacility.id }, shoppingFacility));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutShoppingFacility(int id, ShoppingFacility shoppingFacility)
        {
            if (id != shoppingFacility.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }