public async Task <IActionResult> Edit(int id, [Bind("Id,Brand,Model,Price,Image")] 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)); }