public IHttpActionResult PutImageUploadInfo(int id, ImageUploadInfo imageUploadInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != imageUploadInfo.ImageNo) { return(BadRequest()); } db.Entry(imageUploadInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ImageUploadInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public virtual void Update(T entity) { dbSet.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; }