Ejemplo n.º 1
0
        public async Task GetAllApplications()
        {
            GetAllApplicationsRequest request = new GetAllApplicationsRequest {
                Username = "******"
            };

            var response = await gymApplicationController.getAllApplications(request);

            Assert.IsType <OkObjectResult>(response.Result);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <GymApplications[]> > getAllApplications(GetAllApplicationsRequest request)
        {
            if (request.Username == "")
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Staff username cannot be empty!"));
            }

            SupportUsers staff = await staffRepository.getStaff(request.Username);

            if (staff == null)
            {
                return(StatusCode(StatusCodes.Status401Unauthorized, "Invalid staff member!"));
            }

            GymApplications[] applications = await applicationRepository.getAllApplications();

            return(Ok(applications));
        }