Example #1
0
        public async Task <IActionResult> EditarDetalle(TABLA_DETALLE modelo)
        {
            var mensaje = await _detalleRepository.UpdateDetalle(modelo);

            TempData["mensajedetalle"] = mensaje;
            return(RedirectToAction("VistaDetalle", new { id = modelo.idTablaGeneral }));
        }
Example #2
0
        public async Task <IActionResult> AgregarDetalle(int id)
        {
            var model = await _generalRepository.GetById(id);

            TABLA_DETALLE detalle = new TABLA_DETALLE();

            detalle.idTablaGeneral = model.idTablaGeneral;
            return(PartialView(detalle));
        }
Example #3
0
        public async Task <IActionResult> EditarDetalle(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            TABLA_DETALLE detalle = await _detalleRepository.GetById(id);

            return(PartialView(detalle));
        }
Example #4
0
        public async Task <IActionResult> DeleteDetalle(TABLA_DETALLE modelo)
        {
            try
            {
                TempData["mensajedetalle"] = await _detalleRepository.DeleteDetalle(modelo.idTablaDetalle);

                return(RedirectToAction("VistaDetalle", new { id = modelo.idTablaGeneral }));
            }
            catch
            {
                return(View());
            }
        }
Example #5
0
        public async Task <TABLA_DETALLE> GetById(int?Id)
        {
            TABLA_DETALLE listaDetalle = new TABLA_DETALLE();

            listaDetalle = await(from detalle in _context.TABLA_DETALLE
                                 where detalle.idTablaDetalle == Id
                                 select new TABLA_DETALLE
            {
                idTablaDetalle     = detalle.idTablaDetalle,
                codigoTablaDetalle = detalle.codigoTablaDetalle,
                descripcion        = detalle.descripcion,
                idTablaGeneral     = detalle.idTablaGeneral
            }).FirstOrDefaultAsync();
            return(listaDetalle);
        }
Example #6
0
        public async Task <string> UpdateDetalle(TABLA_DETALLE Detalle)
        {
            try
            {
                _context.Entry(Detalle).Property(x => x.codigoTablaDetalle).IsModified = true;
                _context.Entry(Detalle).Property(x => x.descripcion).IsModified        = true;
                await Save();

                return("Actualizacion Exitosa");
            }
            catch (Exception ex)
            {
                return("Error al actualizar " + ex.StackTrace);
            }
        }
Example #7
0
        public async Task <string> DeleteDetalle(int DetalleID)
        {
            try
            {
                TABLA_DETALLE Detalle = await _context.TABLA_DETALLE.FindAsync(DetalleID);

                _context.TABLA_DETALLE.Remove(Detalle);
                await Save();

                return("Registro eliminado correctamente");
            }
            catch (Exception ex)
            {
                return("Error al eliminar" + ex.Message);
            }
        }
Example #8
0
        public async Task <string> InsertDetalle(TABLA_DETALLE Detalle)
        {
            try
            {
                await _context.TABLA_DETALLE.AddAsync(new TABLA_DETALLE()
                {
                    codigoTablaDetalle = Detalle.codigoTablaDetalle,
                    descripcion        = Detalle.descripcion,
                    idTablaGeneral     = Detalle.idTablaGeneral
                });
                await Save();

                return("Ingreso Exitoso");
            }
            catch (Exception ex)
            {
                return("Error en el guardado " + ex.StackTrace);
            }
        }
Example #9
0
        public async Task <IActionResult> DeleteDetalle(int id)
        {
            TABLA_DETALLE detalle = await _detalleRepository.GetById(id);

            return(PartialView(detalle));
        }
Example #10
0
        public async Task <IActionResult> AgregarDetalle(TABLA_DETALLE modelo)
        {
            TempData["mensajedetalle"] = await _detalleRepository.InsertDetalle(modelo);

            return(RedirectToAction("VistaDetalle", new { id = modelo.idTablaGeneral }));
        }