public int InsertConcepto(TrvRepConceptos concepto) { int val = 0; try { using (ClusmextContext context = new ClusmextContext()) { if (concepto.IdTrvRepConceptos > 0) { context.Entry(concepto).State = EntityState.Modified; } else { context.Entry(concepto).State = EntityState.Added; } val = context.SaveChanges(); } } catch (Exception ex) { } return(val); }
public TrvRepConceptos GetConceptos(int travelId = 0) { TrvRepConceptos c = new TrvRepConceptos(); try { if (travelId == 0) { c.Id_Moneda = 1; c.IdTrvReq = -1; return(c); } else { using (ClusmextContext context = new ClusmextContext()) { c = context.TrvRepConceptos.Where(x => x.IdTrvReq == travelId).SingleOrDefault(); if (c == null) { c = new TrvRepConceptos(); c.IdTrvConceptos = -1; c.Monto = 0; c.Creadopor = -1; c.Id_Moneda = 1; c.IdTrvReq = -1; return(c); } } } } catch (Exception ex) { } return(c); }
public TrvRepConceptos GetConcepto(int ID) { TrvRepConceptos c = new TrvRepConceptos(); try { using (ClusmextContext context = new ClusmextContext()) { c = context.TrvRepConceptos.Include("Ca_Moneda").Where(x => x.IdTrvRepConceptos == ID).SingleOrDefault(); } } catch (Exception ex) { } return(c); }
public int DeleteConcepto(TrvRepConceptos concepto) { int val = 0; try { using (ClusmextContext context = new ClusmextContext()) { context.Entry(concepto).State = EntityState.Deleted; val = context.SaveChanges(); } } catch (Exception ex) { } return(val); }