public async Task <IActionResult> UpdateGood(int id, Good good) { if (id != good.Id) { return(BadRequest()); } _context.Entry(good).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GoodExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Delete(string id) { if (id != null) { Good good = new Good { id = id }; db.Entry(good).State = EntityState.Deleted; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(NotFound()); }
public async Task AddAsync(User item) { db.Entry(item).State = EntityState.Added; await db.SaveChangesAsync(); }