Exemple #1
0
        public IActionResult Index([FromRoute] string squadId)
        {
            ViewData["Title"] = "Squad Details";
            var response = squadQuery.GetFullSquadDetails(System.Guid.Parse(squadId));
            var model    = new SquadDetailsViewModel {
                SquadName = response.Squad.Name, SquadId = response.Squad.Guid.ToString(), Players = response.Players, Coach = response.Coach
            };

            return(View("Index", model));
        }
Exemple #2
0
        public Response UnAssignCoach(Guid squadId, Guid coachId)
        {
            var fullDetails = squadQuery.GetFullSquadDetails(squadId);

            if (fullDetails.Squad == null || fullDetails.Coach == null)
            {
                return(Response.CreateResponse(new List <string> {
                    "The specified squad or coach does not exist"
                }));
            }
            else if (fullDetails.Coach.Guid != coachId)
            {
                return(Response.CreateResponse(new IllegalOperationException("The squad's coach is not the one specified")));
            }

            squadRepository.UnAssignCoach(squadId, coachId);
            return(Response.CreateSuccessResponse());
        }