Skip to content

IPostSubmissionFormVm

Namespace: SlottyMedia.Backend.ViewModel.Partial.MainLayout

This ViewModel represents a form that is used to create a post. It contains fields for the post's textual data and fields that represent corresponding errors.

public interface IPostSubmissionFormVm

Properties

Text

The post's textual content

public abstract string Text { get; set; }

Property Value

String

SpacePrompt

The prompt the user should input in order to select the space. This field is null if a space was selected.

public abstract string SpacePrompt { get; set; }

Property Value

String

SpaceName

The name of the space the user has selected. Null corresponds to no selection.

public abstract string SpaceName { get; set; }

Property Value

String

SearchedSpaces

A list containing all space names that contain the searched prompt

public abstract List<string> SearchedSpaces { get; set; }

Property Value

List<String>

SpaceErrorMessage

An optional error message related to the post's space

public abstract string SpaceErrorMessage { get; set; }

Property Value

String

TextErrorMessage

An optional error message related to the post's textual content

public abstract string TextErrorMessage { get; set; }

Property Value

String

ServerErrorMessage

An optional error message that is caused by some internal server error

public abstract string ServerErrorMessage { get; set; }

Property Value

String

UserInformation

The user information data transfer object to be rendered.

public abstract UserInformationDto UserInformation { get; set; }

Property Value

UserInformationDto

IsLoading

Gets a value indicating whether the data is still loading.

public abstract bool IsLoading { get; set; }

Property Value

Boolean

Methods

HandleSpacePromptChange(ChangeEventArgs, EventCallback<String>)

Handles an event that is triggered whenever the user changes the prompt to select a space. This updates the list of matching spaces in the tooltip above the prompt's input field.

Task HandleSpacePromptChange(ChangeEventArgs e, EventCallback<string> promptValueChanged)

Parameters

e ChangeEventArgs
The input field's change event

promptValueChanged EventCallback<String>
A callback that is invoked asynchronously

Returns

Task

HandleSpaceSelection(String)

Handles an event that is triggered when the user selects a space from the list of available spaces based on the entered prompt. This sets "SpacePrompt" to null and "SpaceName" to the selected space name. This method assumes that the provided space name is valid and does not check whether the provided space actually exists!

void HandleSpaceSelection(string spaceName)

Parameters

spaceName String
The name of the selected space (without hashtag!)

HandleSpaceDeselection()

Handles an event that is triggered when the currently selected space is deselected. This sets "SpaceName" to null.

void HandleSpaceDeselection()

SubmitForm()

Attempts to submit the form. If successful, the post was created. Otherwise, displays an appropriate error message regarding the submission's failure.

Task SubmitForm()

Returns

Task

Initialize(Nullable<Guid>)

Initializes the ViewModel with the specified user ID.

Task Initialize(Nullable<Guid> userId)

Parameters

userId Nullable<Guid>
The ID of the user to load information for.

Returns

Task
A task representing the asynchronous operation.