public IActionResult GetRiders(RiderRequestData RequestData) { if (!_service.IsAuthorizedRider(RequestData)) { return(Unauthorized()); } return(Ok(_context.Riders.ToList())); }
public bool IsAuthorizedRider(FollowRequestData RequestData) { return(_riderService.IsAuthorizedRider(RequestData.RequestingId, RequestData.Authorization)); /* * bool result = false; * if (RiderExists(RequestData.RequestingId)) * { * if (Auth.IsValidToken(RequestData.Authorization)) * { * Rider foundRider = _context.Riders.SingleOrDefault(m => m.ID == RequestData.RequestingId); * if (foundRider != null) * { * string userAuth = Auth.GenerateJWT(foundRider); * if ((RequestData.Authorization == userAuth)) * result = true; * } * } * } * return result; */ }
public bool IsAuthorizedRider(int RiderId, string Authorization) { return(_riderService.IsAuthorizedRider(RiderId, Authorization)); /* * bool result = false; * if (RiderExists(RiderId)) * { * if (Auth.IsValidToken(Authorization)) * { * Rider foundRider = _context.Riders.SingleOrDefault(m => m.ID == RiderId); * * if (foundRider != null) * { * string UserAuth = Auth.GenerateJWT(foundRider); * if (Authorization == UserAuth) * result = true; * } * } * } * return result; */ }
public bool IsAuthorizedRider(RidesRequestData RequestData) { return(_riderService.IsAuthorizedRider(RequestData.RiderId, RequestData.Authorization)); }