Enabling code to use RedirectToAction helpers.
This commit is contained in:
parent
70b45dbe2d
commit
69dae2d216
|
|
@ -107,9 +107,7 @@ namespace MusicStore.Controllers
|
|||
if (result.Succeeded)
|
||||
{
|
||||
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
|
||||
//Bug: No helper methods
|
||||
//return RedirectToAction("Index", "Home");
|
||||
return Redirect("/");
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -154,9 +152,7 @@ namespace MusicStore.Controllers
|
|||
var result = await UserManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
//Bug: No helper method
|
||||
//return RedirectToAction("Manage", new { Message = ManageMessageId.ChangePasswordSuccess });
|
||||
return View();
|
||||
return RedirectToAction("Manage", new { Message = ManageMessageId.ChangePasswordSuccess });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -181,8 +177,7 @@ namespace MusicStore.Controllers
|
|||
var result = await UserManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
//Bug: No helper method
|
||||
//return RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess });
|
||||
return RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -203,9 +198,7 @@ namespace MusicStore.Controllers
|
|||
{
|
||||
// Bug: This should call SignInManager.SignOut() once its available
|
||||
this.Context.Response.SignOut();
|
||||
//Bug: No helper
|
||||
//return RedirectToAction("Index", "Home");
|
||||
return Redirect("/");
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
|
@ -246,13 +239,14 @@ namespace MusicStore.Controllers
|
|||
//Bug: https://github.com/aspnet/WebFx/issues/244
|
||||
returnUrl = string.IsNullOrWhiteSpace(returnUrl) ? "/Home" : returnUrl;
|
||||
//if (Url.IsLocalUrl(returnUrl))
|
||||
if(true)
|
||||
{
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// return RedirectToAction("Index", "Home");
|
||||
//}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -59,10 +59,8 @@ namespace MusicStore.Controllers
|
|||
// Save all changes
|
||||
db.SaveChanges();
|
||||
|
||||
//Bug: Helper not available
|
||||
//return RedirectToAction("Complete",
|
||||
// new { id = order.OrderId });
|
||||
return View();
|
||||
return RedirectToAction("Complete",
|
||||
new { id = order.OrderId });
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ namespace MusicStore.Controllers
|
|||
|
||||
public IActionResult AddToCart(int id)
|
||||
{
|
||||
|
||||
// Retrieve the album from the database
|
||||
var addedAlbum = db.Albums
|
||||
.Single(album => album.AlbumId == id);
|
||||
|
|
@ -45,9 +44,7 @@ namespace MusicStore.Controllers
|
|||
db.SaveChanges();
|
||||
|
||||
// Go back to the main store page for more shopping
|
||||
//Bug: Helper method not available
|
||||
//return RedirectToAction("Index");
|
||||
return View();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -69,9 +69,7 @@ namespace MusicStore.Controllers
|
|||
{
|
||||
db.Albums.Add(album);
|
||||
db.SaveChanges();
|
||||
//Bug: RedirectToAction() not available
|
||||
//return RedirectToAction("Index");
|
||||
return Redirect("/");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
|
||||
|
|
@ -106,9 +104,7 @@ namespace MusicStore.Controllers
|
|||
{
|
||||
db.ChangeTracker.Entry(album).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
//Bug: Missing RedirectToAction helper
|
||||
//return RedirectToAction("Index");
|
||||
return Redirect("/");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
|
||||
ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
|
||||
|
|
@ -139,9 +135,7 @@ namespace MusicStore.Controllers
|
|||
// TODO [EF] Replace with EntitySet.Remove when querying attaches instances
|
||||
db.ChangeTracker.Entry(album).State = EntityState.Deleted;
|
||||
db.SaveChanges();
|
||||
//Bug: Missing helper
|
||||
//return RedirectToAction("Index");
|
||||
return Redirect("/");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
//Bug: Can't dispose db.
|
||||
|
|
|
|||
Loading…
Reference in New Issue