public async Task LoadPersons()
        {
            if (PersonSelected != null)
            {
                IsVisiblePersonGrid           = false;
                IsVisibleEntryPersonFullNames = true;
                return;
            }

            IsVisiblePersonGrid           = true;
            IsVisibleEntryPersonFullNames = false;
            dialogService.ShowProgress();

            ILoginViewModel loginViewModel = ServiceLocator.Current.GetInstance <ILoginViewModel>();
            RequestPeople   request        = new RequestPeople
            {
                IdReference  = loginViewModel.User.IdReference,
                Document     = loginViewModel.User.Document,
                DocumentType = loginViewModel.User.DocumentType
            };
            ResponseBeneficiaries response = await apiService.GetPersons(request);

            dialogService.HideProgress();
            ValidateResponseGetPersons(response);
        }
Beispiel #2
0
 //[ValidateAntiForgeryToken]
 public IActionResult Create([FromBody] RequestPeople entity)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (entity.Id == 0)
             {
                 service.CreateRequest(entity);
                 Response.StatusCode = 201;//Created
                 return(Ok(new { msg = "criado com sucesso!" }));
             }
             else
             {
                 Response.StatusCode = 404;//	Not Acceptable
                 return(null);
             }
         }
         else
         {
             Response.StatusCode = 406;//	Not Acceptable
             return(new ObjectResult("deu ruim!  "));
         }
     }
     catch (Exception e)
     {
         Response.StatusCode = 406;//	Not Acceptable
         return(new ObjectResult("deu ruim! Mensagem: " + e.Message));
     }
 }
Beispiel #3
0
        public void CreateRequest(RequestPeople entity)
        {
            var mapperPeople = mapper.Map <People>(entity);

            /*
             * People people = new People
             * {
             *  Name      = entity.Name,
             *  BirthYear = entity.BirthYear,
             *  EyeColor  = entity.EyeColor,
             *  Gender    = entity.Gender,
             *  HairColor = entity.HairColor,
             *  Height    = entity.Height,
             *  Mass      = entity.Mass,
             *  SkinColor = entity.SkinColor
             * };*/
            repository.Create(mapperPeople);
        }
        public async void LoadPeople()
        {
            try
            {
                RequestPeople request = new RequestPeople
                {
                    IdReference  = loginViewModel.User.IdReference,
                    Document     = loginViewModel.User.Document,
                    DocumentType = loginViewModel.User.DocumentType
                };
                ResponseBeneficiaries response = await apiService.GetPersons(request);

                foreach (var person in response.Beneficiaries)
                {
                    PersonViewModel personViewModel = new PersonViewModel();
                    ViewModelHelper.SetPersonToPersonViewModel(personViewModel, person);
                    People.Add(personViewModel);
                }
            }
            catch (Exception e)
            {
                ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(e);
            }
        }
Beispiel #5
0
    public void RequestPlayersByName(string phrase)
    {
        RequestPeople tmp = new RequestPeople(phrase);

        Links.TcpClient.SendData(tmp.Serialize());
    }