Exemplo n.º 1
0
        //private readonly ComercioDbContext _context;
        //public BancoController(ComercioDbContext context)
        //{
        //    _context = context;
        //}

        // GET: Banco
        public ActionResult Index()
        {
            //var result = await _context.Bancos.ToListAsync();

            BancoRespuesta result = new BancoRespuesta();

            result = new BancoService().ListarAll();

            return(View(result.Lista));
        }
Exemplo n.º 2
0
        public IActionResult Eliminar(int id)
        {
            try
            {
                //var res = BancoLogic.Eliminar(id);
                var res = BancoService.Eliminar(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public BancoQuery(BancoService bancoService)
        {
            Field <BancoType>(
                name: "banco",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                resolve: context =>
            {
                int id = (int)context.Arguments["id"];
                return(bancoService.GetBancoById(id));
            }
                );

            Field <ListGraphType <BancoType> >(
                name: "GetAllBancos",
                resolve: context => { return(bancoService.GetAllBancos()); }
                );
        }
Exemplo n.º 4
0
 // GET: Banco/Create
 public IActionResult Registro(int id = 0)
 {
     if (id == 0)
     {
         return(View(new Banco()));
     }
     else
     {
         BancoRespuesta result = new BancoRespuesta();
         result = new BancoService().GetReg(id);
         if (result.Entidad == null)
         {
             return(View(new Banco()));
         }
         else
         {
             return(View(result.Entidad));
         }
     }
 }
Exemplo n.º 5
0
        public IActionResult Registro([Bind("ID,nombre,direccion,fecha_registro")] Banco _banco)
        {
            if (ModelState.IsValid)
            {
                BancoRespuesta result = new BancoRespuesta();

                if (_banco.ID == 0)
                {
                    //result = BancoLogic.Registrar(_banco);
                    result = BancoService.Registrar(_banco);
                }
                else
                {
                    //result = BancoLogic.Actualizar(_banco);
                    result = BancoService.Actualizar(_banco);
                }


                return(RedirectToAction(nameof(Index)));
            }
            return(View(_banco));
        }
Exemplo n.º 6
0
        public static MvcHtmlString SelectBanco(this HtmlHelper html, int idBanco = 0, bool selecione = false)
        {
            var idEmpresa = new UsuarioService().GetUsuario(System.Web.HttpContext.Current.User.Identity.Name).IdEmpresa;

            var bancos = new BancoService().Listar()
                         .Where(x => x.Ativo == true && x.IdEmpresa == idEmpresa)
                         .OrderBy(x => x.Descricao)
                         .ToList();

            TagBuilder tag = new TagBuilder("select");

            tag.MergeAttribute("id", "IdBanco");
            tag.MergeAttribute("name", "IdBanco");
            tag.MergeAttribute("class", "form-control");

            if (selecione == true)
            {
                TagBuilder itemSel = new TagBuilder("option");
                itemSel.MergeAttribute("value", "0");
                itemSel.SetInnerText("");
                tag.InnerHtml += itemSel.ToString();
            }

            foreach (var item in bancos)
            {
                TagBuilder itemTag = new TagBuilder("option");
                itemTag.MergeAttribute("value", item.Id.ToString());
                if (item.Id == idBanco)
                {
                    itemTag.MergeAttribute("selected", "selected");
                }
                itemTag.SetInnerText(item.Descricao);
                tag.InnerHtml += itemTag.ToString();
            }

            return(new MvcHtmlString(tag.ToString()));
        }
 public BancoController(IConfiguration configuration)
 {
     _configuration = configuration;
     _BancoService  = new BancoService(_configuration);
 }
Exemplo n.º 8
0
 public BancoController(BancoService servico)
 {
     _servico = servico;
 }
 public BancoController(IRepositoryWrapper repository)
 {
     _repository = repository;
     _service    = new BancoService();
 }
Exemplo n.º 10
0
 public BancoController(BancoService bancoService)
 {
     _bancoService = bancoService;
 }
Exemplo n.º 11
0
 public GraphQlController(BancoService bancoService)
 {
     this.bancoService = bancoService;
 }