2
Vote

Edit profile does not return to Index view on Save

description

This alternative version of HomeController.cs returns Display template shape via controller Index action instead of returning Editor template via controller edit action. Works better for me!

[HttpPost, ActionName("Edit")]
    public ActionResult EditPost() {
        if (Services.WorkContext.CurrentUser == null) {
            return HttpNotFound();
        }

        IUser user = Services.WorkContext.CurrentUser;

        dynamic shape = Services.ContentManager.UpdateEditor(user.ContentItem, this);
        if (!ModelState.IsValid) {
            Services.TransactionManager.Cancel();
            return View("Edit", (object)shape);
        }

        Services.Notifier.Information(T("Your profile has been saved."));

        return RedirectToAction("Index",user.UserName); //return RedirectToAction("Edit");
    }

comments