/// <summary> /// Gets all of the service requests from the API and then filters for ones that can be fulfilled /// </summary> /// <returns></returns> private IEnumerable <IServiceRequest> GetFulfillableServiceRequests() { var controller = new PrometheusApiController(_username, _password); var requests = controller.GetServiceRequests(); if (requests != null) { foreach (var request in requests) { if (!IsFulfillableRequest(request)) { yield return(request); } } } }
/// <summary> /// Fulfills the request in Prometheus /// </summary> private void FulfillPrometheusRequest(IServiceRequest request) { Displaymessage($"Set Request {request.Name} to fulfilled", MessageType.Info); request.State = ServiceRequestState.Fulfilled; try { var controller = new PrometheusApiController(_username, _password); request = controller.UpdateRequestById(request.Id, request); if (request.State != ServiceRequestState.Fulfilled) { Displaymessage($"State set to {request.State}", MessageType.Info); } } catch (Exception exception) { Displaymessage($"Error : {exception.Message}", MessageType.Failure); } }