public async Task <ActionResult> GetGraph([FromRoute] Guid guid) { var ucRequest = new UcGetGraphRequest(guid); var result = await this.getGraphUseCase.Handle(ucRequest); var response = new JsonContentResult { StatusCode = (int?)(result.Success ? HttpStatusCode.OK : HttpStatusCode.NotFound), Content = JsonSerializer.SerializeObject(result) }; return(response); }
public async Task <UcGetGraphResponse> Handle(UcGetGraphRequest message) { var entity = await this.repo.GetById(message.GraphId); UcGetGraphResponse response; if (entity != null) { response = new UcGetGraphResponse(entity.Title, entity.Data, true); } else { response = new UcGetGraphResponse(false, "Graph not found"); } return(response); }