public async Task <IActionResult> Edit(int id, [Bind("Id,AspUser,FirstName,Surname,TeamId,IsLeader")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Id", user.TeamId); return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] Project project) { if (id != project.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(project); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(project.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(project)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ProjectId")] Team team) { if (id != team.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProjectId"] = new SelectList(_context.Projects, "Id", "Id", team.ProjectId); return(View(team)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DateFrom,DateTo,QueryCreationDate,HalfDayVacation,IsApproved,ApplicantId,Type")] Vacation vacation) { if (id != vacation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vacation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VacationExists(vacation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicantId"] = new SelectList(_context.Users, "Id", "Id", vacation.ApplicantId); return(View(vacation)); }