Exemple #1
0
        //GET: Gets all team members
        public IActionResult GetTeamMembers([FromBody] GetTeamMembersRequest req)
        {
            List <Employee> result = new List <Employee>();

            try
            {
                // Respond with a 200 - success
                var teamId = req.teamId;
                // teamId is the team id we are searching the members for
                result = manager.GetTeamMembers(teamId).ToList();
                ResponseData <List <Employee> > response = new ResponseData <List <Employee> >();
                response.Content           = result;
                response.Code              = 200;
                response.HasBeenSuccessful = true;
                // Return the populated list
                var httpResult = this.Ok(response);
                return(httpResult);
            }
            catch (Exception e)
            {
                // Respond with a 401, something went wrong
                Console.WriteLine(e.Message);
                ResponseData <List <Employee> > response = new ResponseData <List <Employee> >();
                response.Content           = null;
                response.Code              = 400;
                response.HasBeenSuccessful = false;
                var httpResult = this.Ok(response);
                return(httpResult);
            }
        }