public rosh_docTypes GetDocType(int id) { var res = new rosh_docTypes(); res = db.rosh_docTypes.FirstOrDefault(o => o.id == id); return(res); }
public int SaveDocType(rosh_docTypes res) { try { if (res.id == 0) { db.rosh_docTypes.Add(res); db.SaveChanges(); } else { try { db.Entry(res).State = EntityState.Modified; db.SaveChanges(); } catch (OptimisticConcurrencyException ex) { RDL.Debug.LogError(ex); } } } catch (Exception ex) { RDL.Debug.LogError(ex); } return(res.id); }
public ActionResult DocTypes_createItem() { var parameters = AjaxModel.GetAjaxParameters(HttpContext); var res = false; int savedID = 0; try { var fields = (parameters["fields"] as ArrayList).ToArray().ToList().Select(x => x as Dictionary <string, object>).ToList(); var id = RDL.Convert.StrToInt(AjaxModel.GetValueFromSaveField("id", fields), 0); var name = AjaxModel.GetValueFromSaveField("name", fields); var parentID = RDL.Convert.StrToInt(AjaxModel.GetValueFromSaveField("parentID", fields), 0); var item = new rosh_docTypes { id = id, name = name, parentID = parentID }; mng.Documents.SaveDocType(item); savedID = item.id; res = true; } catch (Exception ex) { res = false; // _debug(ex, new { id }, ""); } return(Json(new { result = res, savedID = savedID, msg = "" }, JsonRequestBehavior.AllowGet)); }
public void SaveDocType(rosh_docTypes res) { try { db.SaveDocType(res); } catch (Exception ex) { RDL.Debug.LogError(ex); } }
public rosh_docTypes GetDocType(int id) { var res = new rosh_docTypes(); try { res = db.GetDocType(id); } catch (Exception ex) { _debug(ex, new { id }, ""); } return(res); }