// PUT api/Market/5 public HttpResponseMessage PutMarketPlace(int id, MarketPlace marketplace) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } if (id != marketplace.InvId) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } db.Entry(marketplace).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public bool AlterarUsuario(UsuarioTable usuario) { try { _context.Entry(usuario).State = EntityState.Modified; _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public T Update(T entity) { if (entity == null) { throw new ArgumentNullException("Null entity"); } _table.Attach(entity); _context.Entry(entity).State = EntityState.Modified; _context.SaveChanges(); return(entity); }
public void Update(SubCategory subCategory) { context.Entry(subCategory).State = EntityState.Modified; context.SaveChanges(); }