コード例 #1
0
 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);
 }
コード例 #2
0
 public void UpdateTeam(TeamViewModel teamViewModel)
 {
     teamRepository.UpdateTeam(teamViewModel);
 }
コード例 #3
0
 public void UpdateTeam(TeamViewModel teamViewModel)
 {
     var teamInDb = context.Teams.Find(teamViewModel.TeamId);
     context.Entry(teamInDb).CurrentValues.SetValues(teamViewModel);
     context.SaveChanges();
 }
コード例 #4
0
 public IHttpActionResult UpdateTeam(TeamViewModel teamViewModel)
 {
     teamDataService.UpdateTeam(teamViewModel);
     return Ok();
 }