diff --git a/src/MusicStore/Controllers/AccountController.cs b/src/MusicStore/Controllers/AccountController.cs index 389adeca79..b0ab8e4715 100644 --- a/src/MusicStore/Controllers/AccountController.cs +++ b/src/MusicStore/Controllers/AccountController.cs @@ -39,6 +39,7 @@ namespace MusicStore.Controllers // // GET: /Account/Login [AllowAnonymous] + //Bug: https://github.com/aspnet/WebFx/issues/339 [HttpGet] public IActionResult Login(string returnUrl) { @@ -77,7 +78,8 @@ namespace MusicStore.Controllers // // GET: /Account/Register [AllowAnonymous] - [HttpGet] //TODO: Do we need this. Without this I seem to be landing here irrespective of the HTTP verb? + //Bug: https://github.com/aspnet/WebFx/issues/339 + [HttpGet] public IActionResult Register() { return View(); @@ -90,7 +92,7 @@ namespace MusicStore.Controllers //[ValidateAntiForgeryToken] public async Task Register(RegisterViewModel model) { - //Bug: https://github.com/aspnet/DataAnnotations/issues/21 + //Bug: https://github.com/aspnet/WebFx/issues/247 //if (ModelState.IsValid == true) { var user = new ApplicationUser() { UserName = model.UserName }; @@ -112,6 +114,7 @@ namespace MusicStore.Controllers // // GET: /Account/Manage + //Bug: https://github.com/aspnet/WebFx/issues/339 [HttpGet] public async Task Manage(ManageMessageId? message) { @@ -130,7 +133,7 @@ namespace MusicStore.Controllers public async Task Manage(ManageUserViewModel model) { ViewBag.ReturnUrl = Url.Action("Manage"); - //Bug: https://github.com/aspnet/DataAnnotations/issues/21 + //Bug: https://github.com/aspnet/WebFx/issues/247 //if (ModelState.IsValid == true) { var user = await GetCurrentUserAsync(); diff --git a/src/MusicStore/Controllers/CheckoutController.cs b/src/MusicStore/Controllers/CheckoutController.cs index d644374374..f25e7bb40e 100644 --- a/src/MusicStore/Controllers/CheckoutController.cs +++ b/src/MusicStore/Controllers/CheckoutController.cs @@ -22,6 +22,7 @@ namespace MusicStore.Controllers // // GET: /Checkout/ + //Bug: https://github.com/aspnet/WebFx/issues/339 [HttpGet] public IActionResult AddressAndPayment() { @@ -31,9 +32,7 @@ namespace MusicStore.Controllers // // POST: /Checkout/AddressAndPayment - //Bug: Using direct model binding until we have TryUpdateModel available. [HttpPost] - //public IActionResult AddressAndPayment(FormCollection values) public async Task AddressAndPayment(Order order) { var formCollection = await Context.Request.GetFormAsync(); diff --git a/src/MusicStore/Controllers/StoreManagerController.cs b/src/MusicStore/Controllers/StoreManagerController.cs index b69e7aee81..e875f24ea8 100644 --- a/src/MusicStore/Controllers/StoreManagerController.cs +++ b/src/MusicStore/Controllers/StoreManagerController.cs @@ -42,8 +42,6 @@ namespace MusicStore.Controllers if (album == null) { - //Bug: Need method HttpNotFound() on Controller - //return HttpNotFound(); return new HttpStatusCodeResult(404); } @@ -90,8 +88,6 @@ namespace MusicStore.Controllers if (album == null) { - //Bug: Need method HttpNotFound() on Controller - //return HttpNotFound(); return new HttpStatusCodeResult(404); } ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId); @@ -118,13 +114,13 @@ namespace MusicStore.Controllers // // GET: /StoreManager/Delete/5 + //Bug: https://github.com/aspnet/WebFx/issues/339 [HttpGet] public IActionResult Delete(int id = 0) { Album album = db.Albums.Single(a => a.AlbumId == id); if (album == null) { - //Bug: Missing Helper return new HttpStatusCodeResult(404); } return View(album); diff --git a/src/MusicStore/Interfaces/IApplicationEnvironment.cs b/src/MusicStore/Interfaces/IApplicationEnvironment.cs index 1c772bc835..682ef343be 100644 --- a/src/MusicStore/Interfaces/IApplicationEnvironment.cs +++ b/src/MusicStore/Interfaces/IApplicationEnvironment.cs @@ -3,6 +3,9 @@ using System.Runtime.Versioning; namespace Microsoft.Net.Runtime { + /// + /// Service provided by the host containing application environment details. + /// [AssemblyNeutral] public interface IApplicationEnvironment { diff --git a/src/MusicStore/Config.json b/src/MusicStore/LocalConfig.json similarity index 100% rename from src/MusicStore/Config.json rename to src/MusicStore/LocalConfig.json diff --git a/src/MusicStore/Models/Album.cs b/src/MusicStore/Models/Album.cs index 7ccca05d15..70a17dd27a 100644 --- a/src/MusicStore/Models/Album.cs +++ b/src/MusicStore/Models/Album.cs @@ -31,7 +31,7 @@ namespace MusicStore.Models public virtual List OrderDetails { get; set; } /// - /// Bug: We use this to populate the order details. This should be removed once we have an actual DB with EF. + /// TODO: Temporary hack to populate the orderdetails until EF does this automatically. /// public Album() { diff --git a/src/MusicStore/Models/IdentityModels.cs b/src/MusicStore/Models/IdentityModels.cs index 0c984ee1c4..a3b8c427aa 100644 --- a/src/MusicStore/Models/IdentityModels.cs +++ b/src/MusicStore/Models/IdentityModels.cs @@ -16,12 +16,4 @@ namespace MusicStore.Models public class ApplicationUser : IdentityUser { } - - //public class ApplicationDbContext : IdentityDbContext - //{ - // public ApplicationDbContext() - // : base("DefaultConnection") - // { - // } - //} } \ No newline at end of file diff --git a/src/MusicStore/Models/ShoppingCart.cs b/src/MusicStore/Models/ShoppingCart.cs index 0740c5d45b..ae71a04777 100644 --- a/src/MusicStore/Models/ShoppingCart.cs +++ b/src/MusicStore/Models/ShoppingCart.cs @@ -23,13 +23,6 @@ namespace MusicStore.Models return cart; } - //TODO: Not used by anyone. Not sure why we have this. - // Helper method to simplify shopping cart calls - //public static ShoppingCart GetCart(MusicStoreEntities db, Controller controller) - //{ - // return GetCart(db, controller.HttpContext); - //} - public void AddToCart(Album album) { // Get the matching cart and album instances @@ -160,7 +153,6 @@ namespace MusicStore.Models // Iterate over the items in the cart, adding the order details for each foreach (var item in cartItems) { - //Bug: Missing EF //var album = _db.Albums.Find(item.AlbumId); var album = _db.Albums.Single(a => a.AlbumId == item.AlbumId); diff --git a/src/MusicStore/Program.cs b/src/MusicStore/Program.cs index 36835e09b8..4523fbfdaf 100644 --- a/src/MusicStore/Program.cs +++ b/src/MusicStore/Program.cs @@ -8,6 +8,10 @@ using System.Threading.Tasks; namespace MusicStore { + /// + /// This demonstrates how the application can be launched in a K console application. + /// k run command in the application folder will invoke this. + /// public class Program { private readonly IServiceProvider _hostServiceProvider; @@ -19,7 +23,7 @@ namespace MusicStore public Task Main(string[] args) { - //Add command line to the configuration source to read command line parameters. + //Add command line configuration source to read command line parameters. var config = new Configuration(); config.AddCommandLine(args); diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index f16b9bc42a..79590daa34 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -31,26 +31,43 @@ public class Startup { app.UseServices(services => { - //Add configuration as a service + /* Adding IConfiguration as a service in the IoC to avoid instantiating Configuration again. + * Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, + * then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. + */ var applicationEnvironment = app.ApplicationServices.GetService(); var configuration = new Configuration(); - configuration.AddJsonFile(Path.Combine(applicationEnvironment.ApplicationBasePath, "Config.json")); - configuration.AddEnvironmentVariables(); //If configuration flows through environment we should pick that first + configuration.AddJsonFile(Path.Combine(applicationEnvironment.ApplicationBasePath, "LocalConfig.json")); + configuration.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. services.AddInstance(configuration); + //Bug: https://github.com/aspnet/Hosting/issues/20 services.AddInstance(new NullLoggerFactory()); + + //Add all MVC related services to IoC. services.AddMvc(); + + /*Add all EF related services to IoC. + Using an InMemoryStore in K until SQL server is available.*/ #if NET45 services.AddEntityFramework(s => s.AddSqlServer()); #else services.AddEntityFramework(s => s.AddInMemoryStore()); #endif services.AddTransient(); - // File an issue trying to use IdentityUser/IdentityRole and open generic UserManager<> + + + /* + * Add all Identity related services to IoC. + * Using an InMemory store to store membership data until SQL server is available. + * Users created will be lost on application shutdown. + */ + + //Bug: https://github.com/aspnet/Identity/issues/50 services.AddIdentity(s => { // Turn off password defaults since register error display blows up - s.UsePasswordValidator(() => new PasswordValidator()); + s.UsePasswordValidator(() => new PasswordValidator()); //s.UseDbContext(() => context); //s.UseUserStore(() => new UserStore(context)); @@ -61,9 +78,12 @@ public class Startup }); }); - //ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production. + /* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline. + * Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production. + */ app.UseErrorPage(ErrorPageOptions.ShowAll); + //Serves static files in the application. app.UseFileServer(); app.UseCookieAuthentication(new CookieAuthenticationOptions() @@ -81,15 +101,23 @@ public class Startup app.UseMvc(routes => { routes.MapRoute( - null, + null, "{controller}/{action}", new { controller = "Home", action = "Index" }); }); + //Populates the MusicStore sample data SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait(); + + //Creates a Store manager user who can manage the store. CreateAdminUser(app.ApplicationServices).Wait(); } + /// + /// Creates a store manager user who can manage the inventory. + /// + /// + /// private async Task CreateAdminUser(IServiceProvider serviceProvider) { var configuration = serviceProvider.GetService(); diff --git a/src/MusicStore/Views/Account/Login.cshtml b/src/MusicStore/Views/Account/Login.cshtml index afe53c3975..f31debf962 100644 --- a/src/MusicStore/Views/Account/Login.cshtml +++ b/src/MusicStore/Views/Account/Login.cshtml @@ -1,7 +1,7 @@ @model MusicStore.Models.LoginViewModel @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Log in"; } @@ -51,7 +51,7 @@ @section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/Account/Manage.cshtml b/src/MusicStore/Views/Account/Manage.cshtml index f2a491ccbd..fef49f927d 100644 --- a/src/MusicStore/Views/Account/Manage.cshtml +++ b/src/MusicStore/Views/Account/Manage.cshtml @@ -1,5 +1,5 @@ @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Manage Account"; } @@ -14,7 +14,7 @@ @section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/Account/Register.cshtml b/src/MusicStore/Views/Account/Register.cshtml index f6c2107aaf..b6a0891300 100644 --- a/src/MusicStore/Views/Account/Register.cshtml +++ b/src/MusicStore/Views/Account/Register.cshtml @@ -1,6 +1,6 @@ @model MusicStore.Models.RegisterViewModel @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Register"; } @@ -39,7 +39,7 @@ } @section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml b/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml index d6bfe9e1bb..298f4a5fa6 100644 --- a/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml +++ b/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml @@ -8,7 +8,7 @@ @Html.AntiForgeryToken()

Change Password Form


- @*@Html.ValidationSummary()*@ + @Html.ValidationSummary()
@Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" })
diff --git a/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml b/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml index 794bebe053..d45711ac3c 100644 --- a/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml +++ b/src/MusicStore/Views/Checkout/AddressAndPayment.cshtml @@ -1,13 +1,13 @@ @model MusicStore.Models.Order @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Address And Payment"; } @section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/Checkout/Complete.cshtml b/src/MusicStore/Views/Checkout/Complete.cshtml index 29f43138da..a5a5e4c244 100644 --- a/src/MusicStore/Views/Checkout/Complete.cshtml +++ b/src/MusicStore/Views/Checkout/Complete.cshtml @@ -1,7 +1,7 @@ @model int @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Checkout Complete"; } diff --git a/src/MusicStore/Views/Home/Index.cshtml b/src/MusicStore/Views/Home/Index.cshtml index 3759a6ec75..2427e67ead 100644 --- a/src/MusicStore/Views/Home/Index.cshtml +++ b/src/MusicStore/Views/Home/Index.cshtml @@ -1,5 +1,5 @@ @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Home Page"; } diff --git a/src/MusicStore/Views/Shared/Error.cshtml b/src/MusicStore/Views/Shared/Error.cshtml index 5c392cebb9..3a7b5effbb 100644 --- a/src/MusicStore/Views/Shared/Error.cshtml +++ b/src/MusicStore/Views/Shared/Error.cshtml @@ -1,5 +1,5 @@ @{ - //Bug: Need a way to specify the layout page in a single place + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Error"; } diff --git a/src/MusicStore/Views/Shared/_Layout.cshtml b/src/MusicStore/Views/Shared/_Layout.cshtml index 8738680ea0..e5f6b093ae 100644 --- a/src/MusicStore/Views/Shared/_Layout.cshtml +++ b/src/MusicStore/Views/Shared/_Layout.cshtml @@ -5,7 +5,7 @@ @ViewBag.Title – MVC Music Store - @*Bug: No Style and Script helpers yet. Manually including the script files*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr")*@ @@ -42,7 +42,7 @@
- @*Bug: No script helpers yet*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap")*@ diff --git a/src/MusicStore/Views/ShoppingCart/Index.cshtml b/src/MusicStore/Views/ShoppingCart/Index.cshtml index be2b76472e..28243b0f76 100644 --- a/src/MusicStore/Views/ShoppingCart/Index.cshtml +++ b/src/MusicStore/Views/ShoppingCart/Index.cshtml @@ -1,6 +1,6 @@ @model MusicStore.ViewModels.ShoppingCartViewModel @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Shopping Cart"; } diff --git a/src/MusicStore/Views/Store/Browse.cshtml b/src/MusicStore/Views/Store/Browse.cshtml index cf176a82a3..377c8333db 100644 --- a/src/MusicStore/Views/Store/Browse.cshtml +++ b/src/MusicStore/Views/Store/Browse.cshtml @@ -1,6 +1,6 @@ @model MusicStore.Models.Genre @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Browse Albums"; } diff --git a/src/MusicStore/Views/Store/Details.cshtml b/src/MusicStore/Views/Store/Details.cshtml index 32f73266aa..97303aa0fb 100644 --- a/src/MusicStore/Views/Store/Details.cshtml +++ b/src/MusicStore/Views/Store/Details.cshtml @@ -1,7 +1,7 @@ @model MusicStore.Models.Album @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Album - " + Model.Title; } diff --git a/src/MusicStore/Views/Store/Index.cshtml b/src/MusicStore/Views/Store/Index.cshtml index 15b44176d1..c6d081ee57 100644 --- a/src/MusicStore/Views/Store/Index.cshtml +++ b/src/MusicStore/Views/Store/Index.cshtml @@ -1,6 +1,6 @@ @model IEnumerable @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Store"; } diff --git a/src/MusicStore/Views/StoreManager/Create.cshtml b/src/MusicStore/Views/StoreManager/Create.cshtml index 27f45c304f..d69a2afbde 100644 --- a/src/MusicStore/Views/StoreManager/Create.cshtml +++ b/src/MusicStore/Views/StoreManager/Create.cshtml @@ -1,8 +1,7 @@ -@*Bug: Fully dependent on HTML helpers*@ -@model MusicStore.Models.Album +@model MusicStore.Models.Album @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Create"; } @@ -71,7 +70,7 @@
@section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/StoreManager/Delete.cshtml b/src/MusicStore/Views/StoreManager/Delete.cshtml index c4d96d3af7..0546b401b5 100644 --- a/src/MusicStore/Views/StoreManager/Delete.cshtml +++ b/src/MusicStore/Views/StoreManager/Delete.cshtml @@ -1,8 +1,7 @@ -@*Bug: Dependent on Htmlhelpers*@ -@model MusicStore.Models.Album +@model MusicStore.Models.Album @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Delete"; } diff --git a/src/MusicStore/Views/StoreManager/Details.cshtml b/src/MusicStore/Views/StoreManager/Details.cshtml index 21e3155834..16b1862920 100644 --- a/src/MusicStore/Views/StoreManager/Details.cshtml +++ b/src/MusicStore/Views/StoreManager/Details.cshtml @@ -1,7 +1,7 @@ @model MusicStore.Models.Album @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Details"; } diff --git a/src/MusicStore/Views/StoreManager/Edit.cshtml b/src/MusicStore/Views/StoreManager/Edit.cshtml index 97b5281ba2..e4297853fb 100644 --- a/src/MusicStore/Views/StoreManager/Edit.cshtml +++ b/src/MusicStore/Views/StoreManager/Edit.cshtml @@ -1,7 +1,7 @@ @model MusicStore.Models.Album @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Edit"; } @@ -71,7 +71,7 @@ @section Scripts { - @*Bug : Script helpers are out of scope for alpha*@ + @*TODO : Until script helpers are available, adding script references manually*@ @*@Scripts.Render("~/bundles/jqueryval")*@ diff --git a/src/MusicStore/Views/StoreManager/Index.cshtml b/src/MusicStore/Views/StoreManager/Index.cshtml index e76a49c734..4956c08af2 100644 --- a/src/MusicStore/Views/StoreManager/Index.cshtml +++ b/src/MusicStore/Views/StoreManager/Index.cshtml @@ -13,7 +13,7 @@ } @{ - //Bug: Need to have a way to specify an application level layout page + //TODO: Until we have a way to specify the layout page at application level. Layout = "/Views/Shared/_Layout.cshtml"; ViewBag.Title = "Index"; }