Example #1
0
        public async Task <IActionResult> PutWagehouse(string id, Wagehouse wagehouse)
        {
            if (id != wagehouse.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Wagehouse> > PostWagehouse(Wagehouse wagehouse)
        {
            _context.Wagehouses.Add(wagehouse);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (WagehouseExists(wagehouse.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetWagehouse", new { id = wagehouse.Id }, wagehouse));
        }