コード例 #1
0
        public ActionResult EditProfile(EditProfileViewModel model, HttpPostedFileBase upload)
        {
            try
            {
                if (!ModelState.IsValid) return View(model);
                var user = _managerUser.GetUserById(model.Id);

                string path = null;
                string pathPic = user.Photo.name;

                if (upload != null && upload.ContentLength > 0)
                {
                    var pic = new AddPhotos();
                    pathPic = pic.AddImage(upload, Server.MapPath("~/images/UploadImages/"), "~/images/UploadImages/");
                }

                user = Mapper.Map<EditProfileViewModel, User>(model,user);

                user.Photo.name = pathPic;
                return RedirectToAction("MyPage", "Profile");
            }
            catch (Exception)
            {
                return View();
            }
        }
コード例 #2
0
 public ActionResult EditProfile(EditProfileViewModel model, long numUser)
 {
     //if (!ModelState.IsValid) return View(model);
     var user = _managerUser.GetUserById(numUser);
     model = Mapper.Map<User, EditProfileViewModel>(user);
     return View(model);
 }