public ActionResult PagarTributo(FormCollection collection) { try { ClienteEntity item = Session[BaseController.USERSESSIONNAME] as ClienteEntity; string url = Url.Content("~") + BaseController.DEFAULTINDEX; var ddl = Request.Form["Opcion"]; TributoEntity tributo = new TributoEntity(); tributo.idTributo = Request.Form["hdnIdTributo"]; tributo.monto = Convert.ToDouble(Request.Form["txtMonto"]); tributo.estado = Request.Form["hdnEstado"]; tributo.tipo = Request.Form["hdnTipo"]; OperacionEntity operacion = new OperacionEntity(); operacion.numeroCuentaRetiro = Request.Form["hdnTipo"]; operacion.cliente = new ClienteEntity(); operacion.cliente.idCliente = item.idCliente; operacion.monto = Convert.ToDouble(Request.Form["txtMonto"]); operacion.numeroCuentaRetiro = ddl; int value = new Service().Pagar(tributo, operacion); if (value != 0) { url = Url.Content("~") + BaseController.DEFAULTINDEX2; } return(new RedirectResult(url)); } catch (Exception ex) { this.ViewBag.Message = ex.Message; return(new RedirectResult(Url.Content("~") + BaseController.DEFAULTINDEX2)); } }
public int Pagar(TributoEntity item, OperacionEntity operacion) { int value = 0; try { string datos = JsonConvert.SerializeObject(item); string json = this.ServicPost(datos, "http://localhost:8888/api/enviar"); string datos2 = JsonConvert.SerializeObject(operacion); string json2 = this.ServicPost(datos2, "http://localhost:8080/api/retiro"); value = 1; } catch (Exception) { value = 0; } return(value); }
public ActionResult Form(int id) { ClienteEntity itemUser = Session[BaseController.USERSESSIONNAME] as ClienteEntity; ContribuyenteEntity item = Session[BaseController.USERSESSION2] as ContribuyenteEntity; TributoEntity item2 = item.tributos.Where(t => t.idTributo == Convert.ToString(id)).FirstOrDefault(); ViewBag.Monto = item2.monto; ViewBag.Codigo = item2.idTributo; ViewBag.Titular = item.titular; List <SelectListItem> lst = new List <SelectListItem>(); foreach (CuentaEntity cuenta in itemUser.cuentas) { lst.Add(new SelectListItem() { Text = cuenta.numeroCuenta, Value = cuenta.numeroCuenta }); } ViewBag.Opciones = lst; return(View()); }