public vas_docTypes GetDocType(int id) { var res = new vas_docTypes(); try { res = db.GetDocType(id); } catch (Exception ex) { _debug(ex, new { docTypeID = id }); res = null; } return(res); }
public vas_docTypes CreateDocType(string name, string code) { var res = new vas_docTypes(); try { res.name = name; res.code = code; db.SaveDocType(res); } catch (Exception ex) { _debug(ex, new { docTypeName = name, docTypeCode = code }); res = null; } return(res); }
public int SaveDocType(vas_docTypes item, bool withSave = true) { if (item.id == 0) { Db.vas_docTypes.Add(item); if (withSave) { Save(); } } else { Db.Entry(item).State = EntityState.Modified; if (withSave) { Save(); } } return(item.id); }