-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
364 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Neptuo; | ||
using Neptuo.Commands; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Commands | ||
{ | ||
/// <summary> | ||
/// A command for changing user's email. | ||
/// </summary> | ||
public class ChangeEmail : Command | ||
{ | ||
/// <summary> | ||
/// Gets an user's email. | ||
/// </summary> | ||
public string Email { get; } | ||
|
||
/// <summary> | ||
/// Creates a new instance. | ||
/// </summary> | ||
/// <param name="email">An user's email.</param> | ||
public ChangeEmail(string email) | ||
{ | ||
Ensure.NotNull(email, "email"); | ||
Email = email; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Money.UI.Blazor/Commands/DemoUserCantBeChangedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Neptuo.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Commands | ||
{ | ||
/// <summary> | ||
/// An excception raised when demo user tries to change it's account. | ||
/// </summary> | ||
public class DemoUserCantBeChangedException : AggregateRootException | ||
{ } | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Money.UI.Blazor/Commands/EmailChangeFailedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Neptuo.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Commands | ||
{ | ||
/// <summary> | ||
/// An exception raised when user email change fails. | ||
/// </summary> | ||
public class EmailChangeFailedException : AggregateRootException | ||
{ } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Neptuo.Models.Keys; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Events | ||
{ | ||
/// <summary> | ||
/// An event raised when user email has been changed. | ||
/// </summary> | ||
public class EmailChanged : UserEvent | ||
{ | ||
public string Email { get; } | ||
|
||
public EmailChanged(IKey key, IKey aggregateKey, string email) | ||
: base(key, aggregateKey, 0) | ||
{ | ||
UserKey = aggregateKey; | ||
Email = email; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Neptuo; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Models | ||
{ | ||
/// <summary> | ||
/// An user profile information. | ||
/// </summary> | ||
public class ProfileModel | ||
{ | ||
/// <summary> | ||
/// Gets an username. | ||
/// </summary> | ||
public string UserName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets an user's email. | ||
/// </summary> | ||
public string Email { get; set; } | ||
|
||
/// <summary> | ||
/// Creates a new instance. | ||
/// </summary> | ||
/// <param name="userName">An username.</param> | ||
/// <param name="email">An user's email.</param> | ||
public ProfileModel(string userName, string email) | ||
{ | ||
Ensure.NotNull(userName, "userName"); | ||
UserName = userName; | ||
Email = email; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
@page "/user" | ||
@inherits ProfileBase | ||
|
||
<UserHead /> | ||
|
||
<div class="user"> | ||
<ExceptionPanel /> | ||
|
||
@if (IsSuccess) | ||
{ | ||
<Alert Message="Your email has been changed." Mode="AlertMode.Success" IsDismissible="true" /> | ||
} | ||
|
||
<div class="row"> | ||
<div class="col-md-6"> | ||
<form method="post" onsubmit="OnFormSubmit"> | ||
<form method="post" onsubmit="@OnFormSubmit"> | ||
<div class="form-group"> | ||
<label for="UserName">UserName</label> | ||
<input class="form-control" disabled="" type="text" id="UserName" name="UserName" value="maraf"> | ||
<input class="form-control" disabled type="text" id="UserName" value="@UserName" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="Email">Email</label> | ||
<div class="input-group"> | ||
<input class="form-control" autofocus type="email" id="Email" name="Email" value=""> | ||
<span class="input-group-addon" aria-hidden="true"><span class="glyphicon glyphicon-ok text-success"></span></span> | ||
</div> | ||
<span class="text-danger field-validation-valid" data-valmsg-for="Email" data-valmsg-replace="true"></span> | ||
<input class="form-control" autofocus type="email" id="Email" bind="@Email" /> | ||
</div> | ||
<button type="submit" class="btn btn-default">Save</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@functions | ||
{ | ||
private async Task OnFormSubmit() | ||
{ | ||
|
||
} | ||
} | ||
</div> |
Oops, something went wrong.