public bool Agregar(ref Expediente pExpediente) { try { using (BDDOCUMENTUMEntities datos = new BaseDAO().conexion()) { datos.Expedientes.AddObject(pExpediente); var vResult = datos.SaveChanges(); if (vResult > 0) return true; else return false; } } catch (Exception) { throw new Exception("Ocurrio un error al registrar el expediente."); } }
public bool Actualizar(ref Expediente pExpediente) { try { using (BDDOCUMENTUMEntities datos = new BaseDAO().conexion()) { datos.Expedientes.Attach(pExpediente); datos.ObjectStateManager.ChangeObjectState(pExpediente, System.Data.EntityState.Modified); var vResult = datos.SaveChanges(); if (vResult > 0) return true; else throw new Exception("No existe el registro Expediente para modificar."); } } catch (Exception) { throw new Exception("Ocurrio un error al actualizar el expediente."); } }