public void Update(int Id, int EXAMENId, string NOMBRE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context); EXAMEN_SINONIMO _EXAMEN_SINONIMO = repositorio.GetById(Id); if(Equals(_EXAMEN_SINONIMO,null)) { throw new Exception(String.Concat("No se ha encontrado EXAMEN_SINONIMO con Id =",Id.ToString())); } RepositorioEXAMEN _repositorioEXAMEN = new RepositorioEXAMEN(context); EXAMEN _objEXAMEN = _repositorioEXAMEN.GetById(EXAMENId); if(Equals(_objEXAMEN,null)) { throw new Exception(String.Concat("No se ha encontrado EXAMEN con Id =",EXAMENId.ToString())); } //properties if (!string.IsNullOrEmpty(NOMBRE)) { _EXAMEN_SINONIMO.NOMBRE = NOMBRE; } //parents _EXAMEN_SINONIMO.EXAMEN = _objEXAMEN; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context); EXAMEN_SINONIMO _EXAMEN_SINONIMO = repositorio.GetById(Id); if(Equals(_EXAMEN_SINONIMO ,null)) { throw new Exception(String.Concat("No se ha encontrado EXAMEN_SINONIMO con Id =",Id.ToString())); } _EXAMEN_SINONIMO.ACTIVO = false; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public EXAMEN_SINONIMO GetById(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context); return repositorio.GetById(ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }