public async Task <IActionResult> PutEgoods(short id, Egoods egoods) { if (id != egoods.EgoodsId) { return(BadRequest()); } _context.Entry(egoods).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EgoodsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Egoods> > PostEgoods(Egoods egoods) { _context.Egoods.Add(egoods); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EgoodsExists(egoods.EgoodsId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEgoods", new { id = egoods.EgoodsId }, egoods)); }