Class UserEditViewModelExtensions
- Namespace
- Dynamicweb.Users.Frontend.UserEdit
- Assembly
- Dynamicweb.Users.dll
Extension helpers for building UserEdit action links.
public static class UserEditViewModelExtensions
- Inheritance
-
UserEditViewModelExtensions
- Inherited Members
Examples
Razor template usage:
@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserEdit.UserEditViewModel> @using Dynamicweb.Users.Frontend.UserEdit
@{ var updateAction = Model.GetEditUserLink(Pageview.Page.ID); // "/?ID=123&Cmd=UpdateUser[&Secret=...]" var deleteAction = Model.GetDeleteUserLink(Pageview.Page.ID); // "/?ID=123&Cmd=DeleteUser[&Secret=...]" }
<form method="post" action="@updateAction"> ... </form> <form method="post" action="@deleteAction"> ... </form>
Remarks
These helpers generate correctly formatted URLs for the UserEdit module. They include the
page ID and the appropriate command (UpdateUser or DeleteUser), and append a
Secret parameter when the target user has a unique ID (used when editing another user).
Use the links as form actions for POST requests:
GetEditUserLink(model, pageId) for updates and
GetDeleteUserLink(model, pageId) for deletion.
Methods
GetDeleteUserLink(UserEditViewModel, int)
Returns an action URL for deleting the user.
public static string? GetDeleteUserLink(this UserEditViewModel model, int pageId)
Parameters
modelUserEditViewModelThe UserEditViewModel instance.
pageIdintThe page ID hosting the UserEdit module.
Returns
- string
A URL like
/?ID={pageId}&Cmd=DeleteUser.
Ifmodel.User.UniqueIdis set, a&Secret={UniqueId}parameter is appended.
GetEditUserLink(UserEditViewModel, int)
Returns an action URL for updating the user.
public static string? GetEditUserLink(this UserEditViewModel model, int pageId)
Parameters
modelUserEditViewModelThe UserEditViewModel instance.
pageIdintThe page ID hosting the UserEdit module.
Returns
- string
A URL like
/?ID={pageId}&Cmd=UpdateUser.
Ifmodel.User.UniqueIdis set, a&Secret={UniqueId}parameter is appended.