Exemplo n.º 1
0
 private async Task UpdatePrisoner(Prisoner p)
 {
     try
     {
         await grpcClient.UpdatePrisoner(ConversionStuff.PrisonerToMessage(p));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        public override Task <PrisonerMessage> GetPrisonerByID(IdMessage request, ServerCallContext context)
        {
            Prisoner p = unitOfWork.PrisonerRepo.GetByID(request.Id);

            return(Task.FromResult(ConversionStuff.PrisonerToMessage(p)));
        }