using System; using System.Collections.Generic; using System.Linq; using ULA.Cathay.CreditoModel.Credito; using Ultimus.Utilitarios; namespace ULA.Cathay.CreditoModel.DAL.Credito { public class MonedaDAL { private UltimusLogs logger = new UltimusLogs("MonedaDAL"); public Moneda ObtenerMoneda(int IdMoneda) { Moneda respuesta = new Moneda(); try { using (CreditoContex db = new CreditoContex()) { respuesta = db.Moneda.Where(x => x.IdMoneda == IdMoneda).FirstOrDefault(); } } catch (Exception ex) { logger.Error(ex); throw ex; } return respuesta; } public Moneda ObtenerMoneda(string Nemonico, string Simbolo = null) { Moneda respuesta = new Moneda(); try { using (CreditoContex db = new CreditoContex()) { if (!string.IsNullOrEmpty(Nemonico)) respuesta = db.Moneda.Where(x => x.Nemonico == Nemonico).FirstOrDefault(); else if (!string.IsNullOrEmpty(Simbolo)) respuesta = db.Moneda.Where(x => x.Simbolo == Simbolo).FirstOrDefault(); } } catch (Exception ex) { logger.Error(ex); throw ex; } return respuesta; } public List Obtener() { List respuesta = new List(); try { using (CreditoContex db = new CreditoContex()) respuesta = db.Moneda.ToList(); } catch (Exception ex) { logger.Error(ex); throw ex; } return respuesta; } } }