public Pagos ObtenerNurc(int id, int IdUser) { Pagos item = new Pagos(); ObjectParameter IdPago = new ObjectParameter("Id_Pago", typeof(Int32)); ObjectParameter VV = new ObjectParameter("VValor_Mensaje", typeof(Int32)); ObjectParameter VM = new ObjectParameter("VMensaje", typeof(String)); try { if (id == 0) { using (ClusmextContext context = new ClusmextContext()) { context.spInsPagoIngresos(IdUser, IdPago, VV, VM); if (VV.Value.ToString() == "0") { id = int.Parse(IdPago.Value.ToString()); item = context.Pagos.Where(x => x.Id_Pago == id).SingleOrDefault(); } } } else { using (ClusmextContext context = new ClusmextContext()) { item = context.Pagos.Where(x => x.Id_Pago == id).SingleOrDefault(); } } } catch (Exception ex) { } return(item); }