public ActionResult ProfileChanges(ProfileModel model, HttpPostedFileBase image) { if (ModelState.IsValid) { if (image != null) { model.ImageMimeType = image.ContentType; model.ImageData = new byte[image.ContentLength]; image.InputStream.Read(model.ImageData, 0, image.ContentLength); } var userId = this.userProcessor.GetUserByName(User.Identity.Name).Id; this.userProcessor.UpdateUsersPhoto(userId, model.ImageData, model.ImageMimeType); } return this.RedirectToAction("Profile"); }
/// <summary> /// The profile. /// </summary> /// <returns> /// The System.Web.Mvc.ActionResult. /// </returns> public ActionResult Profile() { var userId = this.userProcessor.GetUserByName(User.Identity.Name).Id; var model = new ProfileModel { UserName = this.userProcessor.GetUserByName(User.Identity.Name).UserName, Email = this.userProcessor.GetUser(userId).Email, ImageData = this.userProcessor.GetUser(userId).ImageData }; return this.View(model); }