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); }
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")); }
public async Task <IActionResult> EditarTipo(int?id) { if (id == null) { return(NotFound()); } TABLA_GENERAL general = await _generalRepository.GetById(id); return(PartialView(general)); }
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); }
public async Task <IActionResult> DeleteTipo(TABLA_GENERAL modelo) { try { TempData["mensajetipo"] = await _generalRepository.DeleteGeneral(modelo); return(RedirectToAction("Index")); } catch { return(View()); } }
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); } }
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); } }
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); } }
public async Task <IActionResult> AgregarTipo(TABLA_GENERAL modelo) { TempData["mensajetipo"] = await _generalRepository.InsertGeneral(modelo); return(RedirectToAction("Index", "Tablas")); }
// GET: Detalle/Delete/5 public async Task <IActionResult> DeleteTipo(int id) { TABLA_GENERAL general = await _generalRepository.GetById(id); return(PartialView(general)); }