public IActionResult GetAllAvailabilityReservations( [HttpTrigger(AuthorizationLevel.Function, "get", Route = "ReservationFunctionApi/Availability")] HttpRequestMessage req, ExecutionContext context) { /*Validate JWT*/ if ((SecurityJwt.ValidateToken(req.Headers.Authorization, context.FunctionAppDirectory)) == null) { return(new UnauthorizedResult()); } /*Code*/ var query = System.Web.HttpUtility.ParseQueryString(req.RequestUri.Query); string result = query.Get("result"); ReservationDto reservationDto = new ReservationDto() { IdEmployee = Convert.ToInt32(query.Get("idEmployee")), IdService = Convert.ToInt32(query.Get("idService")), IdUser = Convert.ToInt32(query.Get("idUser")), Date = Convert.ToDateTime(query.Get("dateTime")) }; Services service = dbServiceOperations.GetByPk(reservationDto.IdService); Employees employee = dbEmployeeOperations.GetByPk(reservationDto.IdEmployee); reservationDto.IdEmployeeNavigation = _mapper.Map <Employees, EmployeeDto>(employee); reservationDto.IdServiceNavigation = _mapper.Map <Services, ServiceDto>(service); List <ReservationDto> responseMessage = GetAvailability(reservationDto); return(new OkObjectResult(responseMessage)); }
public IActionResult GetEmployee( [HttpTrigger(AuthorizationLevel.Function, "get", Route = "EmployeeFunctionApi/{id:int}")] HttpRequestMessage req, int id, ExecutionContext context) { /*Validate JWT*/ if ((SecurityJwt.ValidateToken(req.Headers.Authorization, context.FunctionAppDirectory)) == null) { return(new UnauthorizedResult()); } /*Code*/ var result = db.GetByPk(id); EmployeeDto responseMessage = _mapper.Map <Employees, EmployeeDto>(result); return(new OkObjectResult(responseMessage)); }