Esempio n. 1
0
        public async Task <IActionResult> EditarTipo(D00_TBGENERAL modelo)
        {
            // D00_TBGENERAL general = _generalRepository.listarxIdGeneral(id);
            var mensaje = await _generalRepository.UpdateGeneral(modelo);

            TempData["mensajetipo"] = mensaje;
            return(RedirectToAction("Index", "Tablas"));
        }
Esempio n. 2
0
        public async Task <D00_TBGENERAL> GetById(int?id)
        {
            D00_TBGENERAL general = await(from p in _context.D00_TBGENERAL
                                          where p.idTab == id
                                          select p).FirstOrDefaultAsync();

            return(general);
        }
Esempio n. 3
0
        public async Task <IActionResult> EditarTipo(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            D00_TBGENERAL general = await _generalRepository.GetById(id);

            return(PartialView(general));
        }
Esempio n. 4
0
        public async Task <DetalleDTO> GetDetalle(int?id)
        {
            DetalleDTO    dto     = new DetalleDTO();
            D00_TBGENERAL general = await generalRepository.GetById(id);

            dto.idTab    = general.idTab;
            dto.codTab   = general.codTab;
            dto.ldetalle = await GetDetalleByIdGeneral(id);

            return(dto);
        }
Esempio n. 5
0
        public async Task <IActionResult> DeleteTipo(D00_TBGENERAL modelo)
        {
            try
            {
                TempData["mensajetipo"] = await _generalRepository.DeleteGeneral(modelo);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 6
0
        public async Task <string> UpdateGeneral(D00_TBGENERAL general)
        {
            try
            {
                _context.Entry(general).Property(x => x.codTab).IsModified      = true;
                _context.Entry(general).Property(x => x.descripcion).IsModified = true;
                await Save();

                return("Actualizacion Exitosa");
            }
            catch (Exception ex)
            {
                return("Error al actualizar " + ex.StackTrace);
            }
        }
Esempio n. 7
0
        public async Task <string> DeleteGeneral(D00_TBGENERAL modelo)
        {
            try
            {
                D00_TBGENERAL general = await _context.D00_TBGENERAL.FindAsync(modelo.idTab);

                _context.D00_TBGENERAL.Remove(general);
                await Save();

                return("Registro eliminado correctamente");
            }
            catch (Exception ex)
            {
                return("Error al eliminar" + ex.Message);
            }
        }
Esempio n. 8
0
        public async Task <string> InsertGeneral(D00_TBGENERAL general)
        {
            try
            {
                await _context.D00_TBGENERAL.AddAsync(new D00_TBGENERAL()
                {
                    codTab      = general.codTab,
                    descripcion = general.descripcion,
                    fechaCreate = DateTime.Now
                });
                await Save();

                return("Ingreso exitoso");
            }
            catch (Exception ex)
            {
                return("Error en el guardado " + ex.StackTrace);
            }
        }
Esempio n. 9
0
        public async Task <IActionResult> AgregarTipo(D00_TBGENERAL modelo)
        {
            TempData["mensajetipo"] = await _generalRepository.InsertGeneral(modelo);

            return(RedirectToAction("Index", "Tablas"));
        }
Esempio n. 10
0
        // GET: Detalle/Delete/5
        public async Task <IActionResult> DeleteTipo(int id)
        {
            D00_TBGENERAL general = await _generalRepository.GetById(id);

            return(PartialView(general));
        }