public override Task <PrisonerArrayMessage> GetPrisonersByName(SearchParamMessage request, ServerCallContext context) { PrisonerArrayMessage pam = new PrisonerArrayMessage(); List <Prisoner> pList = unitOfWork.PrisonerRepo.Get(p => p.LName.ToLower().Contains(request.Value.ToLower()), null, "").ToList(); List <PrisonerMessage> pmList = new List <PrisonerMessage>(); foreach (Prisoner p in pList) { pmList.Add(ConversionStuff.PrisonerToMessage(p)); } pam.Prisoners.AddRange(pmList); return(Task.FromResult(pam)); }
public override Task <PrisonerArrayMessage> GetAllPrisoners(Empty e, ServerCallContext callContext) { PrisonerArrayMessage pam = new PrisonerArrayMessage(); List <Prisoner> pList = unitOfWork.PrisonerRepo.Get(p => true, null, "Location").ToList(); List <PrisonerMessage> pmList = new List <PrisonerMessage>(); foreach (Prisoner p in pList) { Console.WriteLine(p.Location.Name); pmList.Add(ConversionStuff.PrisonerToMessage(p)); } pam.Prisoners.AddRange(pmList); return(Task.FromResult(pam)); }
public async Task <PrisonerArrayMessage> GetPrisonersByName(SearchParamMessage para) { if (client == null || token == "") { Debug.WriteLine("Null client or token"); return(null); } PrisonerArrayMessage reply = null; try { reply = await client.GetPrisonersByNameAsync(para, headers); } catch (Exception e) { Debug.WriteLine(e.Message); } return(reply); }
public async Task <PrisonerArrayMessage> GetAllPrisoners() { if (client == null || token == "") { Debug.WriteLine("Null client or token"); return(null); } PrisonerArrayMessage reply = null; try { reply = await client.GetAllPrisonersAsync(new Google.Protobuf.WellKnownTypes.Empty(), headers); } catch (Exception e) { Debug.WriteLine(e.Message); } return(reply); }