示例#1
0
        public override Task <Empty> UpdatePrisoner(PrisonerMessage request, ServerCallContext context)
        {
            Prisoner p = ConversionStuff.MessageToPrisoner(request);

            if (!ValidationUtility.IsPrisonerValid(p))
            {
                return(Task.FromResult(new Empty()));
            }
            unitOfWork.PrisonerRepo.Update(p);
            unitOfWork.Save();
            return(Task.FromResult(new Empty()));
        }
示例#2
0
        public async Task LoadPrisoners()
        {
            var result = await grpcClient.GetAllPrisoners();

            if (result == null)
            {
                return;
            }
            ClearPrisoners();
            foreach (PrisonerMessage p in result.Prisoners)
            {
                prisoners.Add(ConversionStuff.MessageToPrisoner(p));
            }
        }
示例#3
0
        public async Task SearchPrisonersByName(string para)
        {
            var result = await grpcClient.GetPrisonersByName(new SearchParamMessage { Value = para });

            if (result == null)
            {
                return;
            }
            ClearPrisoners();
            foreach (PrisonerMessage p in result.Prisoners)
            {
                prisoners.Add(ConversionStuff.MessageToPrisoner(p));
            }
            LoadPrisonerLocations();
        }