示例#1
0
        public ActionResult UserEdit(Guid?id)
        {
            Model.D_User_Model model = new Model.D_User_Model();

            if (id.HasValue)
            {
                model = new DAL.D_User_DAL().GetModel(id.Value);
            }
            return(View(model));
        }
示例#2
0
        //[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult UserEdit(Model.D_User_Model model)
        {
            bool success = false;

            try
            {
                Model.D_User_Model dataModel = null;
                if (model.UserGuid == Guid.Empty)
                {
                    dataModel = new Model.D_User_Model();

                    dataModel.CreateDateTime = DateTime.Now;
                    dataModel.CreateUserGuid = UserView.UserGuid;
                    dataModel.CreateUserName = UserView.UserName;

                    dataModel.DataStatus = false;
                }
                else
                {
                    dataModel = new DAL.D_User_DAL().GetModel(model.UserGuid);
                }

                dataModel.UserLoginName  = model.UserLoginName;
                dataModel.UserName       = model.UserName;
                dataModel.PassWord       = new DAL.D_User_DAL().PassWordMD5(model.PassWord);
                dataModel.IsAdmin        = model.IsAdmin;
                dataModel.DepartmentName = model.DepartmentName;
                dataModel.ModifyDateTime = DateTime.Now;
                dataModel.ModifyUserGuid = UserView.UserGuid;
                dataModel.ModifyUserName = UserView.UserName;

                success = new DAL.D_User_DAL().Save(dataModel);
                return(Json(new { success = success, message = "成功" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { success = success, message = ex.Message }));
            }
        }