Esempio n. 1
0
        public CuponsVM()
        {
            CupomResp       = new CupomModel();
            ListaCuponsView = new List <Cupon>();
            //MostraPopUpCommand = new Command(MostraPopUp);
            NoVoCupomCommand = new Command(NoVoCupom);

            PovoarListaCupons();
        }
Esempio n. 2
0
        protected override void ToEntidade()
        {
            CupomModel vm = (CupomModel)ViewModel;

            Entidades[typeof(Cupom).Name] = new Cupom
            {
                Valor  = vm.Valor,
                Codigo = vm.Codigo
            };
        }
Esempio n. 3
0
        protected override void ToViewModel()
        {
            Cupom cupom = (Cupom)Entidades[typeof(Cupom).Name];

            CupomModel vm = new CupomModel
            {
                Codigo = cupom.Codigo.ToString(),
                Valor  = (double)cupom.Valor
            };

            _viewModel = vm;
        }
Esempio n. 4
0
        //CUPONS *
        public static CupomModel GetCupons(string cnpj)
        {
            string URL     = "https://ganhemais.site/api/Cupom.php?cnpj={0}";
            string NovoURL = string.Format(URL, cnpj);

            WebClient wc       = new WebClient();
            string    Conteudo = wc.DownloadString(NovoURL);


            CupomModel cupons = new CupomModel();

            cupons = Task.Run(() => { return(JsonConvert.DeserializeObject <CupomModel>(Conteudo)); }).Result;

            return(cupons);
        }