public HttpResponseMessage DeleteTeam(TeamViewModel team) { var listOfEmployeesInTeam = employeeDataService.GetEmployeesByTeamId(team.TeamId); if (listOfEmployeesInTeam.Count > 0) { var message = string.Format("The team {0} has {1} member (s) in it. The team must be empty to be deleted.", team.TeamName, listOfEmployeesInTeam.Count()); return Request.CreateResponse(HttpStatusCode.OK, message); } teamDataService.DeleteTeam(team.TeamId); return Request.CreateResponse(HttpStatusCode.OK); }
public void UpdateTeam(TeamViewModel teamViewModel) { teamRepository.UpdateTeam(teamViewModel); }
public void UpdateTeam(TeamViewModel teamViewModel) { var teamInDb = context.Teams.Find(teamViewModel.TeamId); context.Entry(teamInDb).CurrentValues.SetValues(teamViewModel); context.SaveChanges(); }
public IHttpActionResult UpdateTeam(TeamViewModel teamViewModel) { teamDataService.UpdateTeam(teamViewModel); return Ok(); }