Exemple #1
0
        public IActionResult AssignTeamToAircraft([FromBody] AssignTeamToAircraft form)
        {
            // Assign the body request to the suitable variables
            var aircraftId = form.AircraftId;
            var teamId     = form.TeamId;
            var res        = new BaseResponse();

            try
            {
                // Send the variables to the Manager
                var createdTask = manager.AssignTeamToAircraft(aircraftId, teamId);
                if (createdTask)
                {
                    // Respond with a 200 - success
                    res.Code = 200;
                    res.HasBeenSuccessful = true;
                    return(Ok(res));
                }
                // Respond with a 401, something went wrong
                res.Code = 401;
                res.HasBeenSuccessful = false;
                return(Ok(res));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // Respond with a 401, something went wrong internally
                res.Code = 501;
                res.HasBeenSuccessful = false;
                return(Ok(res));
            }
        }