public Models.Parameter.Response.FreightConsult Consult(Models.Parameter.Request.FreightConsult parameters)
        {
            var ret     = new Models.Parameter.Response.FreightConsult();
            var address = _cepService.GetAddress(parameters.CepDestino);

            ret.Valor  = Math.Round(((parameters.Peso * 5) * parameters.Tamanho) / 10, 2);
            ret.Cidade = address.cidade;
            ret.Estado = address.uf;
            ret.Rua    = address.logradouro;

            return(ret);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SearchCep(string cep)
        {
            Address address = null;

            ViewBag.Error = false;
            try
            {
                address = await _cepService.GetAddress(cep);
            }
            catch
            {
                ViewBag.Error = true;
            }
            return(View("SearchCep", address));
        }