示例#1
0
        public HttpResponseMessage Calculo(OperacaoViewModel model)
        {
            try
            {
                ClienteAdquirente           Adquirente    = new ClienteAdquirente();
                ClienteAdquirenteRepository repAdquirente = new ClienteAdquirenteRepository();
                ClienteAdquirente           adquirente    = repAdquirente.Adquirente(model.Adquirente);



                decimal taxa = 10;
                if (model.Tipo.Equals("credito"))
                {
                    taxa = repAdquirente.Credito(model.Bandeira, adquirente.IdClienteAdquirente);
                }
                else if (model.Tipo.Equals("debito"))
                {
                    taxa = repAdquirente.Credito(model.Bandeira, adquirente.IdClienteAdquirente);
                }


                OperacaoSaidaViewModel saida = new OperacaoSaidaViewModel();
                saida.ValorLiquido = (model.Valor) - (model.Valor * taxa / 100);

                return(Request.CreateResponse(HttpStatusCode.OK, saida));
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Erro servidor: " + e.Message));
            }
        }
示例#2
0
 public ActionResult Operacao(OperacaoViewModel model)
 {
     return(View(model));
 }