using System; using System.Collections.Generic; using System.Linq; using ULA.Cathay.CreditoModel.Credito; using Ultimus.Utilitarios; using System.Data.Entity.Validation; namespace ULA.Cathay.CreditoModel.DAL.Credito { public class AbogadoDAL { private UltimusLogs logger = new UltimusLogs("AbogadoDAL"); public Abogados ObtenerAbogado(int? IdAbogado) { Abogados listaAbogados = new Abogados(); try { using (CreditoContex db = new CreditoContex()) listaAbogados = db.Abogados.Where(e => e.IdAbogado == IdAbogado).FirstOrDefault(); ; } catch (DbEntityValidationException ex1) { logger.Error(ex1); throw ex1; } catch (Exception ex) { logger.Error(ex); throw ex; } return listaAbogados; } public List Obtener() { List respuesta = new List(); try { using (CreditoContex db = new CreditoContex()) respuesta = db.Abogados.Where(x => x.Estado == true).ToList(); } catch (DbEntityValidationException ex1) { logger.Error(ex1); throw ex1; } catch (Exception ex) { logger.Error(ex); throw ex; } return respuesta; } } }