()).Handle);
38 | });
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/WebUI/Features/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Confirm Email";
3 | }
4 |
5 | @ViewBag.Title.
6 |
7 |
8 | Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
9 |
10 |
11 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ExternalLoginConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ExternalLoginConfirmationViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 | @ViewBag.Title.
6 | Associate your @ViewBag.LoginProvider account.
7 |
8 | @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 |
12 | Association Form
13 |
14 | @Html.ValidationSummary(true, "", new { @class = "text-danger" })
15 |
16 | You've successfully authenticated with @ViewBag.LoginProvider.
17 | Please enter a user name for this site below and click the Register button to finish
18 | logging in.
19 |
20 |
27 |
32 | }
33 |
34 | @section Scripts {
35 | @Scripts.Render("~/bundles/jqueryval")
36 | }
37 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ExternalLoginFailure.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Login Failure";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 | Unsuccessful login with service.
8 |
9 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ForgotPasswordViewModel
2 | @{
3 | ViewBag.Title = "Forgot your password?";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Enter your email.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Forgot Password Confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Please check your email to reset your password.
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/Login.cshtml:
--------------------------------------------------------------------------------
1 | @using WebUI.Models
2 | @model LoginViewModel
3 | @{
4 | ViewBag.Title = "Log in";
5 | }
6 |
7 | @ViewBag.Title.
8 |
60 |
61 | @section Scripts {
62 | @Scripts.Render("~/bundles/jqueryval")
63 | }
--------------------------------------------------------------------------------
/WebUI/Features/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.RegisterViewModel
2 | @{
3 | ViewBag.Title = "Register";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Create a new account.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 |
39 | @section Scripts {
40 | @Scripts.Render("~/bundles/jqueryval")
41 | }
42 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ResetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Reset password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Reset your password.
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 | @Html.HiddenFor(model => model.Code)
15 |
21 |
27 |
33 |
38 | }
39 |
40 | @section Scripts {
41 | @Scripts.Render("~/bundles/jqueryval")
42 | }
43 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Reset password confirmation";
3 | }
4 |
5 |
6 | @ViewBag.Title.
7 |
8 |
9 |
10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/SendCode.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.SendCodeViewModel
2 | @{
3 | ViewBag.Title = "Send";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("rememberMe", @Model.RememberMe)
11 | Send verification code
12 |
13 |
14 |
15 | Select Two-Factor Authentication Provider:
16 | @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers)
17 |
18 |
19 |
20 | }
21 |
22 | @section Scripts {
23 | @Scripts.Render("~/bundles/jqueryval")
24 | }
25 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/VerifyCode.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.VerifyCodeViewModel
2 | @{
3 | ViewBag.Title = "Verify";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {
9 | @Html.AntiForgeryToken()
10 | @Html.Hidden("provider", @Model.Provider)
11 | @Html.Hidden("rememberMe", @Model.RememberMe)
12 | Enter verification code
13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" })
15 |
21 |
29 |
34 | }
35 |
36 | @section Scripts {
37 | @Scripts.Render("~/bundles/jqueryval")
38 | }
39 |
--------------------------------------------------------------------------------
/WebUI/Features/Account/_ExternalLoginsListPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ExternalLoginListViewModel
2 | @using Microsoft.Owin.Security
3 |
4 | Use another service to log in.
5 |
6 | @{
7 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
8 | if (loginProviders.Count() == 0) {
9 |
10 |
11 | There are no external authentication services configured. See this article
12 | for details on setting up this ASP.NET application to support logging in via external services.
13 |
14 |
15 | }
16 | else {
17 | using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) {
18 | @Html.AntiForgeryToken()
19 |
20 |
21 | @foreach (AuthenticationDescription p in loginProviders) {
22 |
23 | }
24 |
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/WebUI/Features/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "About";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/WebUI/Features/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Contact";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
--------------------------------------------------------------------------------
/WebUI/Features/Home/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Mvc;
2 |
3 | namespace WebUI.Features.Home {
4 | public class HomeController : Controller {
5 |
6 | public ActionResult Index() {
7 | return View();
8 | }
9 |
10 | public ActionResult About() {
11 | ViewBag.Message = "Your application description page.";
12 |
13 | return View();
14 | }
15 |
16 | public ActionResult Contact() {
17 | ViewBag.Message = "Your contact page.";
18 |
19 | return View();
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/WebUI/Features/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page";
3 | }
4 |
5 |
6 |
ASP.NET
7 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
8 |
Learn more »
9 |
10 |
11 |
12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/WebUI/Features/Manage/AddPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.AddPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Add a phone number
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
25 | }
26 |
27 | @section Scripts {
28 | @Scripts.Render("~/bundles/jqueryval")
29 | }
30 |
--------------------------------------------------------------------------------
/WebUI/Features/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ChangePasswordViewModel
2 | @{
3 | ViewBag.Title = "Change Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | Change Password Form
12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" })
14 |
20 |
26 |
32 |
37 | }
38 | @section Scripts {
39 | @Scripts.Render("~/bundles/jqueryval")
40 | }
--------------------------------------------------------------------------------
/WebUI/Features/Manage/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.IndexViewModel
2 | @{
3 | ViewBag.Title = "Manage";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @ViewBag.StatusMessage
9 |
10 |
Change your account settings
11 |
12 |
13 | - Password:
14 | -
15 | [
16 | @if (Model.HasPassword)
17 | {
18 | @Html.ActionLink("Change your password", "ChangePassword")
19 | }
20 | else
21 | {
22 | @Html.ActionLink("Create", "SetPassword")
23 | }
24 | ]
25 |
26 | - External Logins:
27 | -
28 | @Model.Logins.Count [
29 | @Html.ActionLink("Manage", "ManageLogins") ]
30 |
31 | @*
32 | Phone Numbers can used as a second factor of verification in a two-factor authentication system.
33 |
34 | See this article
35 | for details on setting up this ASP.NET application to support two-factor authentication using SMS.
36 |
37 | Uncomment the following block after you have set up two-factor authentication
38 | *@
39 | @*
40 | - Phone Number:
41 | -
42 | @(Model.PhoneNumber ?? "None")
43 | @if (Model.PhoneNumber != null)
44 | {
45 |
46 | [ @Html.ActionLink("Change", "AddPhoneNumber") ]
47 | using (Html.BeginForm("RemovePhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
48 | {
49 | @Html.AntiForgeryToken()
50 | []
51 | }
52 | }
53 | else
54 | {
55 | [ @Html.ActionLink("Add", "AddPhoneNumber")
56 | }
57 |
58 | *@
59 | - Two-Factor Authentication:
60 | -
61 |
62 | There are no two-factor authentication providers configured. See this article
63 | for details on setting up this ASP.NET application to support two-factor authentication.
64 |
65 | @*@if (Model.TwoFactor)
66 | {
67 | using (Html.BeginForm("DisableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
68 | {
69 | @Html.AntiForgeryToken()
70 | Enabled
71 |
72 |
73 | }
74 | }
75 | else
76 | {
77 | using (Html.BeginForm("EnableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
78 | {
79 | @Html.AntiForgeryToken()
80 | Disabled
81 |
82 |
83 | }
84 | }*@
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/WebUI/Features/Manage/ManageLogins.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.ManageLoginsViewModel
2 | @using Microsoft.Owin.Security
3 | @{
4 | ViewBag.Title = "Manage your external logins";
5 | }
6 |
7 | @ViewBag.Title.
8 |
9 | @ViewBag.StatusMessage
10 | @{
11 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
12 | if (loginProviders.Count() == 0) {
13 |
14 |
15 | There are no external authentication services configured. See this article
16 | for details on setting up this ASP.NET application to support logging in via external services.
17 |
18 |
19 | }
20 | else
21 | {
22 | if (Model.CurrentLogins.Count > 0)
23 | {
24 | Registered Logins
25 |
53 | }
54 | if (Model.OtherLogins.Count > 0)
55 | {
56 | using (Html.BeginForm("LinkLogin", "Manage"))
57 | {
58 | @Html.AntiForgeryToken()
59 |
60 |
61 | @foreach (AuthenticationDescription p in Model.OtherLogins)
62 | {
63 |
64 | }
65 |
66 |
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/WebUI/Features/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.SetPasswordViewModel
2 | @{
3 | ViewBag.Title = "Create Password";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | You do not have a local username/password for this site. Add a local
9 | account so you can log in without an external login.
10 |
11 |
12 | @using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
13 | {
14 | @Html.AntiForgeryToken()
15 |
16 | Create Local Login
17 |
18 | @Html.ValidationSummary("", new { @class = "text-danger" })
19 |
25 |
31 |
36 | }
37 | @section Scripts {
38 | @Scripts.Render("~/bundles/jqueryval")
39 | }
--------------------------------------------------------------------------------
/WebUI/Features/Manage/VerifyPhoneNumber.cshtml:
--------------------------------------------------------------------------------
1 | @model WebUI.Models.VerifyPhoneNumberViewModel
2 | @{
3 | ViewBag.Title = "Verify Phone Number";
4 | }
5 |
6 | @ViewBag.Title.
7 |
8 | @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
9 | {
10 | @Html.AntiForgeryToken()
11 | @Html.Hidden("phoneNumber", @Model.PhoneNumber)
12 | Enter verification code
13 | @ViewBag.Status
14 |
15 | @Html.ValidationSummary("", new { @class = "text-danger" })
16 |
22 |
27 | }
28 |
29 | @section Scripts {
30 | @Scripts.Render("~/bundles/jqueryval")
31 | }
32 |
--------------------------------------------------------------------------------
/WebUI/Features/RoastPlanning/Create.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Create New Roast Schedule";
3 | }
4 |
5 | @ViewBag.Title.
6 | @ViewBag.Message
7 |
8 | @using (Html.BeginForm())
9 | {
10 |
20 | }
--------------------------------------------------------------------------------
/WebUI/Features/RoastPlanning/Index.cshtml:
--------------------------------------------------------------------------------
1 | @using WebUI.Models
2 | @model List
3 | @{
4 | ViewBag.Title = "Roast Planning";
5 | }
6 |
7 | @ViewBag.Title.
8 | @ViewBag.Message
9 |
10 | @if (@Model.Count > 0)
11 | {
12 | Your Roast Schedules:
13 | foreach (var roastSchedule in @Model)
14 | {
15 |
16 | - @($"RoastScheduleId: {@roastSchedule.RoastScheduleId}, RoastWeekStartsOn: {@roastSchedule.RoastWeekStartsOn.ToShortDateString()}")
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WebUI/Features/RoastPlanning/RoastPlanningController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Web.Mvc;
4 | using FirstPopCoffee.Common.Domain.Model;
5 | using FirstPopCoffee.RoastPlanning.Domain.Model;
6 | using WebUI.ReadModel;
7 |
8 | namespace WebUI.Features.RoastPlanning
9 | {
10 | public class RoastPlanningController : Controller
11 | {
12 | private readonly ICommandSender _bus;
13 | private readonly IRoastPlanningReadModel _readModel;
14 |
15 | public RoastPlanningController(ICommandSender bus, IRoastPlanningReadModel readModel)
16 | {
17 | _bus = bus;
18 | _readModel = readModel;
19 | }
20 |
21 | public ActionResult Index()
22 | {
23 | var viewModel = _readModel.RoastSchedules.ToList();
24 | return View(viewModel);
25 | }
26 |
27 | public ActionResult Create()
28 | {
29 | return View();
30 | }
31 |
32 | [HttpPost]
33 | public ActionResult Create(string create)
34 | {
35 | _bus.Send(new CreateNewRoastScheduleCommand(Guid.NewGuid()));
36 | return this.RedirectToAction(nameof(Index));
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/WebUI/Features/RoastPlanning/RoastSchedule.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Roast Schedule";
3 | }
4 |
5 | @ViewBag.Title.
6 |
7 |
8 |
9 |
10 |
11 |
12 | Day |
13 | Is Roast Day |
14 |
15 |
16 |
17 |
18 | Monday |
19 | Y |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/WebUI/Features/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 |
--------------------------------------------------------------------------------
/WebUI/Features/Shared/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @model System.Web.Mvc.HandleErrorInfo
2 |
3 | @{
4 | ViewBag.Title = "Locked Out";
5 | }
6 |
7 |
8 | Locked out.
9 | This account has been locked out, please try again later.
10 |
11 |
--------------------------------------------------------------------------------
/WebUI/Features/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title - My ASP.NET Application
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
24 | - @Html.ActionLink("Home", "Index", "Home")
25 | - @Html.ActionLink("About", "About", "Home")
26 | - @Html.ActionLink("Contact", "Contact", "Home")
27 |
28 | @Html.Partial("_LoginPartial")
29 |
30 |
31 |
32 |
33 | @RenderBody()
34 |
35 |
38 |
39 |
40 | @Scripts.Render("~/bundles/jquery")
41 | @Scripts.Render("~/bundles/bootstrap")
42 | @RenderSection("scripts", required: false)
43 |
44 |
45 |
--------------------------------------------------------------------------------
/WebUI/Features/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNet.Identity
2 | @if (Request.IsAuthenticated)
3 | {
4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
5 | {
6 | @Html.AntiForgeryToken()
7 |
8 |
9 | -
10 | @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
11 |
12 | - Log off
13 |
14 | }
15 | }
16 | else
17 | {
18 |
19 | - @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
20 | - @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/WebUI/Features/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/WebUI/Features/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Features/Shared/_Layout.cshtml";
3 | }
4 |
--------------------------------------------------------------------------------
/WebUI/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="WebUI.MvcApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/WebUI/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Optimization;
7 | using System.Web.Routing;
8 | using FirstPopCoffee.Common.Domain.Model;
9 | using FirstPopCoffee.Common.Events;
10 | using FirstPopCoffee.RoastPlanning.Application;
11 | using FirstPopCoffee.RoastPlanning.Domain.Model;
12 | using Ninject;
13 | using WebUI.Infrastructure;
14 | using WebUI.ReadModel;
15 |
16 | namespace WebUI
17 | {
18 | public class MvcApplication : System.Web.HttpApplication
19 | {
20 | protected void Application_Start()
21 | {
22 | AreaRegistration.RegisterAllAreas();
23 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
24 | RouteConfig.RegisterRoutes(RouteTable.Routes);
25 | BundleConfig.RegisterBundles(BundleTable.Bundles);
26 |
27 | ViewEngines.Engines.Clear();
28 | ViewEngines.Engines.Add(new FeatureViewLocationRazorViewEngine());
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/WebUI/Infrastructure/FakeDbSet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Data.Entity;
5 | using System.Data.Entity.Infrastructure;
6 | using System.Linq;
7 | using System.Linq.Expressions;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using System.Web;
11 |
12 | namespace WebUI.Infrastructure
13 | {
14 | public class FakeDbSet : DbSet, IQueryable, IEnumerable, IDbAsyncEnumerable
15 | where TEntity : class
16 | {
17 | ObservableCollection _data;
18 | IQueryable _query;
19 |
20 | public FakeDbSet()
21 | {
22 | _data = new ObservableCollection();
23 | _query = _data.AsQueryable();
24 | }
25 |
26 | public override TEntity Add(TEntity item)
27 | {
28 | _data.Add(item);
29 | return item;
30 | }
31 |
32 | public override TEntity Remove(TEntity item)
33 | {
34 | _data.Remove(item);
35 | return item;
36 | }
37 |
38 | public override TEntity Attach(TEntity item)
39 | {
40 | _data.Add(item);
41 | return item;
42 | }
43 |
44 | public override TEntity Create()
45 | {
46 | return Activator.CreateInstance();
47 | }
48 |
49 | public override TDerivedEntity Create()
50 | {
51 | return Activator.CreateInstance();
52 | }
53 |
54 | public override ObservableCollection Local {
55 | get { return _data; }
56 | }
57 |
58 | Type IQueryable.ElementType {
59 | get { return _query.ElementType; }
60 | }
61 |
62 | Expression IQueryable.Expression {
63 | get { return _query.Expression; }
64 | }
65 |
66 | IQueryProvider IQueryable.Provider {
67 | get { return new FakeDbAsyncQueryProvider(_query.Provider); }
68 | }
69 |
70 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
71 | {
72 | return _data.GetEnumerator();
73 | }
74 |
75 | IEnumerator IEnumerable.GetEnumerator()
76 | {
77 | return _data.GetEnumerator();
78 | }
79 |
80 | IDbAsyncEnumerator IDbAsyncEnumerable.GetAsyncEnumerator()
81 | {
82 | return new FakeTestDbAsyncEnumerator(_data.GetEnumerator());
83 | }
84 | }
85 |
86 | internal class FakeDbAsyncQueryProvider : IDbAsyncQueryProvider
87 | {
88 | private readonly IQueryProvider _inner;
89 |
90 | internal FakeDbAsyncQueryProvider(IQueryProvider inner)
91 | {
92 | _inner = inner;
93 | }
94 |
95 | public IQueryable CreateQuery(Expression expression)
96 | {
97 | return new FakeDbAsyncEnumerable(expression);
98 | }
99 |
100 | public IQueryable CreateQuery(Expression expression)
101 | {
102 | return new FakeDbAsyncEnumerable(expression);
103 | }
104 |
105 | public object Execute(Expression expression)
106 | {
107 | return _inner.Execute(expression);
108 | }
109 |
110 | public TResult Execute(Expression expression)
111 | {
112 | return _inner.Execute(expression);
113 | }
114 |
115 | public Task