public int Guardar(Ca_Tipo_Codole item) { int val = 0; try { using (ClusmextContext context = new ClusmextContext()) { if (item.Id_Tipo_Codole > 0) { context.Entry(item).State = EntityState.Modified; } else { context.Entry(item).State = EntityState.Added; } val = context.SaveChanges(); } } catch (Exception ex) { } return(val); }
public Ca_Tipo_Codole ObtenerTipo(int id) { Ca_Tipo_Codole list = new Ca_Tipo_Codole(); try { if (id == 0) { return(list); } using (ClusmextContext context = new ClusmextContext()) { list = context.Ca_Tipo_Codole.Where(x => x.Id_Tipo_Codole == id).SingleOrDefault(); } } catch (Exception ex) { } return(list); }