public async Task <IActionResult> Edit(int id, [Bind("id,PhotoPath,LangId")] IndexPhoto indexPhoto) { if (id != indexPhoto.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(indexPhoto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IndexPhotoExists(indexPhoto.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(indexPhoto)); }
public async Task <IActionResult> Create([Bind("id,PhotoPath,LangId")] IndexPhoto indexPhoto) { if (ModelState.IsValid) { _context.Add(indexPhoto); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(indexPhoto)); }