示例#1
0
        public ActionResult DocTypes_save()
        {
            var parameters = AjaxModel.GetAjaxParameters(HttpContext);
            var mng        = new DocsManager();
            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 code = AjaxModel.GetValueFromSaveField("code", fields);

                var item = new doc_docTypes {
                    id = id, name = name, code = code
                };
                mng.SaveDocType(item);
                savedID = item.id;
                res     = true;
            }
            catch (Exception ex)
            {
                res = false;
            }
            return(Json(new
            {
                result = res,
                savedID = savedID,
                msg = ""
            }, JsonRequestBehavior.AllowGet));
        }