Exemplo n.º 1
0
 public ActionResult Detail(DictionaryWebM model, bool isEdit)
 {
     if (ModelState.IsValid)
     {
         model.dt_key = model.dt_key.Trim();
         DictionaryTableDb dbModel = new DictionaryTableDb();
         ModelCopier.CopyModel(model, dbModel);
         if (isEdit)
         {
             dbModel.modifi_name = LoginUser.user_name;
             dbModel.modifi_date = DateTime.Now;
             DictionaryTableBll.Instance.Update(dbModel);
             return(Content("<script>alert('修改字典成功!');parent.layer.closeAll('iframe');</script>"));
         }
         else
         {
             dbModel.creator_name = LoginUser.user_name;
             dbModel.creator_date = DateTime.Now;
             DictionaryTableBll.Instance.Add(dbModel);
             return(Content("<script>alert('添加字典成功!');parent.layer.closeAll('iframe');</script>"));
         }
     }
     ViewBag.EditType = isEdit;
     return(View(model));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(string key = "")
        {
            DictionaryWebM webModel = new DictionaryWebM();

            if (string.IsNullOrEmpty(key))
            {
                ViewBag.EditType = false;
            }
            else
            {
                ViewBag.EditType = true;
                DictionaryTableDb model = DictionaryTableBll.Instance.GetModel(key);
                ModelCopier.CopyModel(model, webModel);
            }
            return(View(webModel));
        }