Model for the Create page. This class is decorated with the Authorize attribute.
More...
Model for the Create page. This class is decorated with the Authorize attribute.
◆ CreateModel()
BetterFinds.Pages.CreateModel.CreateModel |
( |
IConfiguration |
configuration, |
|
|
IHubContext< NotificationHub > |
hubContext |
|
) |
| |
|
inline |
Initializes a new instance of the CreateModel class.
- Parameters
-
configuration | The IConfiguration instance. |
hubContext | The IHubContext instance. |
◆ OnGet()
void BetterFinds.Pages.CreateModel.OnGet |
( |
| ) |
|
|
inline |
◆ OnPost()
IActionResult BetterFinds.Pages.CreateModel.OnPost |
( |
| ) |
|
|
inline |
Creates a new auction if all requirements are met.
-
The starting price must be greater than 0.
-
The minimum bid must be greater than 0.
-
The title must be between 1 and 64 characters long.
-
The description must be between 1 and 2048 characters long.
-
The end time must be a valid date and time and greater than the current time.
-
The images must be valid, if any. See Utils.Images.IsValidImages.
If all requirements are met, the auction is created and the user is redirected to the new auction page. Otherwise, the user stays on the page and an error message is displayed.
The users on the IndexModel or SearchModel pages are notified that there's updates.
The auction is added to the background service to check for its ending.
When a auction is created it triggers the AuctionCreated
event in the SignalR hub, updating relevant pages that there's updates to display.
Event trigger example:
hubContext.Clients.All.SendAsync(
"AuctionCreated").Wait();
readonly IHubContext< NotificationHub > hubContext
The IHubContext instance.
Definition: Create.cshtml.cs:25
- Returns
- A task that represents the action of creating a new auction.
◆ configuration
readonly IConfiguration BetterFinds.Pages.CreateModel.configuration |
|
private |
The IConfiguration instance.
◆ hubContext
readonly IHubContext<NotificationHub> BetterFinds.Pages.CreateModel.hubContext |
|
private |
The IHubContext instance.
◆ Description
string BetterFinds.Pages.CreateModel.Description = "" |
|
getset |
The description of the auction.
◆ EndTime
string BetterFinds.Pages.CreateModel.EndTime = "" |
|
getset |
The end time of the auction.
◆ Images
string? BetterFinds.Pages.CreateModel.Images |
|
getset |
The images of the auction.
◆ MinimumBid
decimal BetterFinds.Pages.CreateModel.MinimumBid = 0.01M |
|
getset |
The minimum bid of the auction.
◆ Price
decimal BetterFinds.Pages.CreateModel.Price = 0.01M |
|
getset |
The starting price of the auction.
◆ Title
string BetterFinds.Pages.CreateModel.Title = "" |
|
getset |
The title of the auction.
The documentation for this class was generated from the following file:
- BetterFinds/Pages/Create.cshtml.cs