コード例 #1
0
        public async Task <TABLA_GENERAL> GetById(int?id)
        {
            TABLA_GENERAL general = await(from p in _context.TABLA_GENERAL
                                          where p.idTablaGeneral == id
                                          select p).FirstOrDefaultAsync();

            return(general);
        }
コード例 #2
0
ファイル: TablasController.cs プロジェクト: CEM-HIS/HIS
        public async Task <IActionResult> EditarTipo(TABLA_GENERAL modelo)
        {
            // TABLA_GENERAL general = _generalRepository.listarxIdGeneral(id);
            var mensaje = await _generalRepository.UpdateGeneral(modelo);

            TempData["mensajetipo"] = mensaje;
            return(RedirectToAction("Index", "Tablas"));
        }
コード例 #3
0
ファイル: TablasController.cs プロジェクト: CEM-HIS/HIS
        public async Task <IActionResult> EditarTipo(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            TABLA_GENERAL general = await _generalRepository.GetById(id);

            return(PartialView(general));
        }
コード例 #4
0
ファイル: DetalleRepository.cs プロジェクト: CEM-HIS/HIS
        public async Task <DetalleDTO> GetDetalle(int?id)
        {
            DetalleDTO    dto     = new DetalleDTO();
            TABLA_GENERAL general = await generalRepository.GetById(id);

            dto.idTablaGeneral     = general.idTablaGeneral;
            dto.codigoTablaGeneral = general.codigoTablaGeneral;
            dto.detalles           = await GetDetalleByIdGeneral(id);

            return(dto);
        }
コード例 #5
0
ファイル: TablasController.cs プロジェクト: CEM-HIS/HIS
        public async Task <IActionResult> DeleteTipo(TABLA_GENERAL modelo)
        {
            try
            {
                TempData["mensajetipo"] = await _generalRepository.DeleteGeneral(modelo);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #6
0
        public async Task <string> UpdateGeneral(TABLA_GENERAL general)
        {
            try
            {
                _context.Entry(general).Property(x => x.codigoTablaGeneral).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);
            }
        }
コード例 #7
0
        public async Task <string> DeleteGeneral(TABLA_GENERAL modelo)
        {
            try
            {
                TABLA_GENERAL general = await _context.TABLA_GENERAL.FindAsync(modelo.idTablaGeneral);

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

                return("Registro eliminado correctamente");
            }
            catch (Exception ex)
            {
                return("Error al eliminar" + ex.Message);
            }
        }
コード例 #8
0
        public async Task <string> InsertGeneral(TABLA_GENERAL general)
        {
            try
            {
                await _context.TABLA_GENERAL.AddAsync(new TABLA_GENERAL()
                {
                    codigoTablaGeneral = general.codigoTablaGeneral,
                    descripcion        = general.descripcion,
                    fechaCreacion      = DateTime.Now
                });
                await Save();

                return("Ingreso exitoso");
            }
            catch (Exception ex)
            {
                return("Error en el guardado " + ex.StackTrace);
            }
        }
コード例 #9
0
ファイル: TablasController.cs プロジェクト: CEM-HIS/HIS
        public async Task <IActionResult> AgregarTipo(TABLA_GENERAL modelo)
        {
            TempData["mensajetipo"] = await _generalRepository.InsertGeneral(modelo);

            return(RedirectToAction("Index", "Tablas"));
        }
コード例 #10
0
ファイル: TablasController.cs プロジェクト: CEM-HIS/HIS
        // GET: Detalle/Delete/5
        public async Task <IActionResult> DeleteTipo(int id)
        {
            TABLA_GENERAL general = await _generalRepository.GetById(id);

            return(PartialView(general));
        }