public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_MUESTRA repositorio = new RepositorioPRESTACION_MUESTRA(context); PRESTACION_MUESTRA _PRESTACION_MUESTRA = repositorio.GetById(Id); if (Equals(_PRESTACION_MUESTRA, null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION_MUESTRA con Id =", Id.ToString())); } _PRESTACION_MUESTRA.ACTIVO = false; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public PRESTACION_MUESTRA GetById(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_MUESTRA repositorio = new RepositorioPRESTACION_MUESTRA(context); return(repositorio.GetById(ID)); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int PRESTACIONId, string NOMBRE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_MUESTRA repositorio = new RepositorioPRESTACION_MUESTRA(context); PRESTACION_MUESTRA _PRESTACION_MUESTRA = repositorio.GetById(Id); if (Equals(_PRESTACION_MUESTRA, null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION_MUESTRA con Id =", Id.ToString())); } RepositorioPRESTACION _repositorioPRESTACION = new RepositorioPRESTACION(context); PRESTACION _objPRESTACION = _repositorioPRESTACION.GetById(PRESTACIONId); if (Equals(_objPRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION con Id =", PRESTACIONId.ToString())); } //properties if (!string.IsNullOrEmpty(NOMBRE)) { _PRESTACION_MUESTRA.NOMBRE = NOMBRE; } //parents _PRESTACION_MUESTRA.PRESTACION = _objPRESTACION; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }