public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price,Quantity")] Phone phone) { if (id != phone.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(phone); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhoneExists(phone.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(phone)); }
public async Task <IActionResult> Edit(int id, [Bind("PhoneId,OrderId")] PhoneOrder phoneOrder) { if (id != phoneOrder.PhoneId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(phoneOrder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhoneOrderExists(phoneOrder.PhoneId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Order, "Id", "Id", phoneOrder.OrderId); ViewData["PhoneId"] = new SelectList(_context.Phone, "Id", "Id", phoneOrder.PhoneId); return(View(phoneOrder)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Body,SentBy,Posted,IP")] Comment comment) { if (id != comment.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(comment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(comment.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(comment)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Size")] Memory memory) { if (id != memory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(memory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MemoryExists(memory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(memory)); }