Exemplo n.º 1
0
        public ActionResult UploadAction()
        {
            string fileName = Guid.NewGuid().ToString();

            //遍历所有文件域
            foreach (string fieldName in Request.Files.AllKeys)
            {
                HttpPostedFileBase file        = Request.Files[fieldName];
                string             virtualPath = string.Format("~/Images/HeadImage/{0}.jpg", fileName);
                string             imagePath   = string.Format("../../Images/HeadImage/{0}.jpg", fileName);
                file.SaveAs(Server.MapPath(virtualPath));
                MemberView updateInfo = new MemberView();
                updateInfo.HeadImage     = imagePath;
                updateInfo.UserName      = ((SystemUser)Session["SystemUser"]).UserName;
                updateInfo.IsDeleted     = ((SystemUser)Session["SystemUser"]).IsDeleted;
                updateInfo.IsStartUse    = ((SystemUser)Session["SystemUser"]).IsStartUse;
                updateInfo.Id            = ((SystemUser)Session["SystemUser"]).Id;
                updateInfo.NickName      = ((SystemUser)Session["SystemUser"]).NickName;
                updateInfo.Password      = ((SystemUser)Session["SystemUser"]).Password;
                updateInfo.AddDate       = ((SystemUser)Session["SystemUser"]).AddDate;
                updateInfo.ContactNumber = ((SystemUser)Session["SystemUser"]).ContactNumber;
                updateInfo.Email         = ((SystemUser)Session["SystemUser"]).Email;
                ((SystemUser)Session["SystemUser"]).HeadImage = imagePath;
                AccountContract.Update(updateInfo);
            }
            OperationResultType result = OperationResultType.Success;

            return(Json(result));
        }
Exemplo n.º 2
0
        public ActionResult updateUserInfo(MemberView user)
        {
            SystemUser SystemUser = AccountContract.SysUsers.FirstOrDefault(m => m.Id == user.Id);

            user.AddDate   = SystemUser.AddDate;
            user.HeadImage = SystemUser.HeadImage;
            AccountContract.Update(user);
            return(View());
        }