public async Task <IActionResult> Edit(int id, [Bind("Price,Id")] Bid bid, int propId) { if (id != bid.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var prop = await _context.ThematicProps.SingleOrDefaultAsync(m => m.Id == propId); bid.ThematicPropId = prop.Id; _context.Entry(bid).State = EntityState.Modified; await _context.SaveChangesAsync(); UpdateThematicProp(prop); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BidExists(bid.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bid)); }
public void Update(T entity) { IsEntityNull(entity); //_entities.Attach(entity); _context.Entry(entity).State = EntityState.Modified; Save(); }