public async Task <IHttpActionResult> PutAlbum(int id, Album album) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != album.AlbumID) { return(BadRequest()); } db.Entry(album).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlbumExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutPhotos(int id, Photo photo) { return(StatusCode(HttpStatusCode.NotImplemented)); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != photo.PhotoID) { return(BadRequest()); } db.Entry(photo).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhotosExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Update(Like like) { db.Entry(like).State = EntityState.Modified; db.SaveChanges(); }
public void Update(TEntity entityToUpdate) { dbSet.Attach(entityToUpdate); context.Entry(entityToUpdate).State = EntityState.Modified; }
public void Update(T item) { _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); }