Beispiel #1
0
        public ActionResult Edit(string nickname)
        {
            //MembershipUser user = Membership.GetUser(nickname);
            var user = _repo.UsersInfo.Single(u => u.Username.Equals(nickname));

            EditModel editModel = new EditModel()
            {
                ImageUser = user.Image
                ,ImageMimeType = user.ImageType,
                Email = user.Email,
                UserName = nickname,
                Name = user.Name
            };

            return View(editModel);
        }
Beispiel #2
0
        public ActionResult Edit(EditModel model, HttpPostedFileBase image)
        {
            //MembershipUser user = Membership.GetUser(model.NickName);
            var user = _repo.UsersInfo.Single(u => u.Username.Equals(model.UserName));
            user.Email = model.Email;
            if (image != null)
            {
                user.Image = new byte[image.ContentLength];
                user.ImageType = image.ContentType;
                image.InputStream.Read(user.Image, 0, image.ContentLength);
            }
            _repo.SaveChanges();

            //Membership.UpdateUser(user);

            //dynamic pb = ProfileBase.Create(model.NickName);
            //pb.NameUser = model.Name;
            //if (image != null)
            //{
            //    pb.Image = new byte[image.ContentLength];
            //    pb.ImageType = image.ContentType;
            //    image.InputStream.Read(pb.Image, 0, image.ContentLength);
            //}

            //pb.Save();

            return RedirectToAction("Index", "Home");
        }