public async Task <ActionResult <List <ProtocolResult> > > GetAllProtocols() { var results = new List <ProtocolResult>(); var department = await _departmentsService.GetDepartmentByIdAsync(DepartmentId, false); var protocols = await _protocolsService.GetAllProtocolsForDepartmentAsync(DepartmentId); foreach (var p in protocols) { results.Add(ProtocolResult.Convert(p)); } return(Ok(results)); }
public List <ProtocolResult> GetAllProtocols() { var results = new List <ProtocolResult>(); var department = _departmentsService.GetDepartmentById(DepartmentId, false); var protocols = _protocolsService.GetAllProtocolsForDepartment(DepartmentId); foreach (var p in protocols) { results.Add(ProtocolResult.Convert(p)); } return(results); }
public async Task <ActionResult> GetProtocol(int protocolId) { var protocol = await _protocolsService.GetProtocolByIdAsync(protocolId); if (protocol == null) { return(NotFound()); } if (protocol.DepartmentId != DepartmentId) { return(Unauthorized()); } var result = ProtocolResult.Convert(protocol); return(Ok(JsonConvert.SerializeObject(result))); }