BetterFinds
Public Member Functions | Properties | Private Attributes | List of all members
BetterFinds.Pages.EditModel Class Reference

Model for the Edit Auction page. This class is decorated with the Authorize attribute. More...

Inheritance diagram for BetterFinds.Pages.EditModel:
Inheritance graph
[legend]
Collaboration diagram for BetterFinds.Pages.EditModel:
Collaboration graph
[legend]

Public Member Functions

 EditModel (IConfiguration configuration)
 Initializes a new instance of the EditModel class. More...
 
IActionResult OnGet ()
 Shows the edit auction page. More...
 
IActionResult OnPost ()
 Edits the auction if all requirements are met. More...
 

Properties

string Title = "" [get, set]
 The auction title. More...
 
string Description = "" [get, set]
 The auction description. More...
 
decimal MinimumBid = 0.01M [get, set]
 The auction minimum bid. More...
 
string? Images [get, set]
 The auction images. More...
 

Private Attributes

readonly IConfiguration configuration
 The IConfiguration instance. More...
 

Detailed Description

Model for the Edit Auction page. This class is decorated with the Authorize attribute.

Constructor & Destructor Documentation

◆ EditModel()

BetterFinds.Pages.EditModel.EditModel ( IConfiguration  configuration)

Initializes a new instance of the EditModel class.

Parameters
configurationThe IConfiguration instance.

Member Function Documentation

◆ OnGet()

IActionResult BetterFinds.Pages.EditModel.OnGet ( )
inline

Shows the edit auction page.

Checks if the auction exists and belongs to the client. If so, displays the auction details. Otherwise, redirects to the not found error (404) page.

Returns
A task that represents the action of loading the edit auction page.

◆ OnPost()

IActionResult BetterFinds.Pages.EditModel.OnPost ( )
inline

Edits the auction if all requirements are met.

Checks if the auction exists and belongs to the client. If so, updates the auction details as long as they meet the validation requirements:

  • Minimum bid must be greater than 0.
  • Title must be between 1 and 64 characters.
  • Description must be between 1 and 2048 characters.
  • Images must be valid.

If the auction details are updated successfully, redirects to the edit auction page with a success message. Otherwise, redisplays the edit auction page with an error message.

Returns
A task that represents the action of editing the auction.

Member Data Documentation

◆ configuration

readonly IConfiguration BetterFinds.Pages.EditModel.configuration
private

The IConfiguration instance.

Property Documentation

◆ Description

string BetterFinds.Pages.EditModel.Description = ""
getset

The auction description.

◆ Images

string? BetterFinds.Pages.EditModel.Images
getset

The auction images.

◆ MinimumBid

decimal BetterFinds.Pages.EditModel.MinimumBid = 0.01M
getset

The auction minimum bid.

◆ Title

string BetterFinds.Pages.EditModel.Title = ""
getset

The auction title.


The documentation for this class was generated from the following file: