public static bool DeleteDocumentTypes(int id) { motskin_documentTypes element = _documentTypes.FirstOrDefault(p => p.id == id); if (element != null) { _documentTypes.Remove(element); return(true); } return(false); }
public static int SaveDocumentTypes(motskin_documentTypes element, bool withSave = true) { if (element.id == 0) { element.id = _documentTypes.Count + 1; _documentTypes.Add(element); } else { int pos = _documentTypes.IndexOf(_documentTypes.FirstOrDefault(p => p.id == element.id)); if (pos >= 0) { _documentTypes[pos] = element; } } return(_documentTypes.Count); }
public int SaveDocumentType(motskin_documentTypes element, bool withSave = true) { #if !PSEUDO if (element.id == 0) { db.motskin_documentTypes.Add(element); if (withSave) { Save(); } } else { db.Entry(element).State = EntityState.Modified; if (withSave) { Save(); } } return(element.id); #else return(PseudoData.SaveDocumentTypes(element)); #endif }