public ActionResult ChangeAvatar(HttpPostedFileBase file) { InitViewBag(); int userid = Convert.ToInt32(Session["CurrentUserId"]); if (file != null) { string path = FileController.SaveImage(HttpContext, file); _unitOfWork.Users.SetAvatar(userid, path); ViewBag.CurrentUser.Avatar = path; } return(View("Index")); }
public ActionResult Step3(HttpPostedFileBase file, string username) { if (!string.IsNullOrEmpty(username)) { if (_unitOfWork.Users.ContainsUserWithSuchUsername(username)) { return(View("Step3", _userModel)); } _userModel.Username = username; if (file != null) { _userModel.Avatar = FileController.SaveImage(HttpContext, file); } return(RedirectToAction("Step4")); } else { return(View("Step3", _userModel)); } }