public Employee(EmployeeViewModel employeeModel) { this.Id = employeeModel.Id; this.FirstName = employeeModel.FirstName; this.LastName = employeeModel.LastName; this.DateOfBirth = employeeModel.DateOfBirth; this.TeamId = employeeModel.TeamId; this.Team = employeeModel.Team; }
public ActionResult Edit(EditCreateTeamViewModel teamModel) { if (ModelState.IsValid) { Team team = new Team(teamModel); db.Entry(team).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(teamModel); }
public ListDeleteTeamViewModel(Team team) { base.Id = team.Id; base.Name = team.Name; this.DateCreated = team.DateCreated; if (team.Employees != null) { _employeeCount = team.Employees.Count; } }
public ActionResult Create(EditCreateTeamViewModel teamModel) { if (ModelState.IsValid) { Team team = new Team(teamModel); db.Teams.Add(team); db.SaveChanges(); return RedirectToAction("Index"); } return View(teamModel); }