public async Task <IActionResult> Edit(int id, [Bind("Id,Manufacturer,Model,Min_ISO,Max_ISO,Mounting_id")] Camera camera) { if (id != camera.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(camera); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CameraExists(camera.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(camera)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Account_id,Camera_id,Lens_id,Publish_date,Title,Pulse")] Post post) { if (id != post.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(post); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(post.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(post)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Mounting mounting) { if (id != mounting.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mounting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MountingExists(mounting.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(mounting)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Fullname,Country")] Account account) { if (id != account.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(account); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountExists(account.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(account)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ISBN,Price,Category,AuthorId")] Book book) { if (id != book.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Author, "Id", "Name", book.AuthorId); return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Manufacturer,Model,Aperture,Min_focal_length,Max_focal_length,Mounting_id")] Lens lens) { if (id != lens.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lens); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LensExists(lens.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lens)); }