public async Task <IActionResult> Edit(int id, [Bind("iD,Brand,Name,batteryLife,LaunchDate,phoneWeight,phoneOS,phoneCPU,phoneDisplay,phoneRating,phoneImage")] 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("Id,Brand,ReleaseDate,Rating,Price")] 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)); }