public async Task <IActionResult> Edit(int id, [Bind("Id,MinutesWorked,StaffId,ClientId,LocationId")] Timesheet timesheet) { if (id != timesheet.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(timesheet); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimesheetExists(timesheet.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "BillingAddress", timesheet.ClientId); ViewData["LocationId"] = new SelectList(_context.Locations, "Id", "Address", timesheet.LocationId); ViewData["StaffId"] = new SelectList(_context.Staff, "Id", "Email", timesheet.StaffId); return(View(timesheet)); }
public async Task <IActionResult> Edit(int id, [Bind("CompanyId,Name,IsActive")] Company company) { if (id != company.CompanyId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(company); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyExists(company.CompanyId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address")] Location location) { if (id != location.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(location); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationExists(location.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,BillingAddress,ContactName,ContactTelephone,ContactEmail")] 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,Surname,Forename,Email")] Staff staff) { if (id != staff.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staff); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staff)); }