public async Task <IActionResult> Edit(int id, [Bind("Id,Client,Text")] Suggestion suggestion) { if (id != suggestion.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(suggestion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SuggestionExists(suggestion.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Client"] = new SelectList(_context.Clients, "Id", "Name", suggestion.Client); return(View(suggestion)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Phone,Position,Salary")] Employee employee) { if (id != employee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Position"] = new SelectList(_context.Positions, "Id", "Position1", employee.Position); return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PassportId,Phone,DateRegister")] Client client) { if (id != client.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price")] Service service) { if (id != service.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(service); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(service.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(service)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,IdClient,IdNumber,DateSet,DateOut,Service")] Booking booking) { if (id != booking.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(booking); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(booking.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdClient"] = new SelectList(_context.Clients, "Id", "Name", booking.IdClient); ViewData["IdNumber"] = new SelectList(_context.Numbers, "Id", "Name", booking.IdNumber); ViewData["Service"] = new SelectList(_context.Services, "Id", "Name", booking.Service); return(View(booking)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Type,Price")] Number number) { if (id != number.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(number); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NumberExists(number.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Type"] = new SelectList(_context.NumberTypes, "Id", "Name", number.Type); return(View(number)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Position1")] Position position) { if (id != position.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(position); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PositionExists(position.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(position)); }