public async Task <Photo> UpdateAsync(Photo photo) { context.Update(photo); await context.SaveChangesAsync(); return(photo); }
public async Task <Comment> UpdateAsync(Comment comment) { context.Update(comment); await context.SaveChangesAsync(); return(comment); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description")] Photo photo) { if (id != photo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(photo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhotoExists(photo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(photo)); }
public async Task <Photo> UpdateAsync(Photo photo) { //context.Entry(photo).State = EntityState.Modified; context.Update(photo); await context.SaveChangesAsync(); return(photo); }