Class UserAddressViewModelExtensions
- Namespace
- Dynamicweb.Users.Frontend.UserAddresses
- Assembly
- Dynamicweb.Users.dll
Extension methods for UserAddressViewModel
public static class UserAddressViewModelExtensions
- Inheritance
-
UserAddressViewModelExtensions
- Inherited Members
Examples
Razor template usage:
@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserAddresses.UserAddressViewModel> @using Dynamicweb.Users.Frontend.UserAddresses
@{ var saveAction = Model.GetSaveAddressLink(Pageview.Page.ID); // "/?ID=123&Cmd=SaveAddress&AddressId=45" var deleteAction = Model.GetDeleteAddressLink(Pageview.Page.ID); // "/?ID=123&Cmd=DeleteAddress&AddressId=45" }
<form method="post" action="@saveAction"> ... </form> <form method="post" action="@deleteAction"> ... </form>
Remarks
These helpers simplify building action links from UserAddressViewModel. The most common usage is calling GetSaveAddressLink(UserAddressViewModel, int) in a Razor template to post the edit form, or GetDeleteAddressLink(UserAddressViewModel, int) to delete the current address.
Use the returned URLs as form actions for POST requests. Each link includes the page ID, the command,
and the current AddressId.
Methods
GetDeleteAddressLink(UserAddressViewModel, int)
Gets a POST action URL for saving the current address (?Cmd=DeleteAddress).
public static string? GetDeleteAddressLink(this UserAddressViewModel model, int pageId)
Parameters
modelUserAddressViewModelThe UserAddressViewModel instance from the edit template. May be
null.pageIdintThe ID of the page hosting the UserAddresses module (typically
Pageview.Page.ID).
Returns
- string
A URL like
/?ID={pageId}&Cmd=DeleteAddress&AddressId={model.Address.Id}whenmodelis notnull.
Remarks
Prefer using this link with a method="post" form for destructive actions. This is a safe accessor — it returns
null if the model itself is null. The method always includes the current AddressId.
GetSaveAddressLink(UserAddressViewModel, int)
Gets a POST action URL for saving the current address (?Cmd=SaveAddress).
public static string? GetSaveAddressLink(this UserAddressViewModel model, int pageId)
Parameters
modelUserAddressViewModelThe UserAddressViewModel instance from the edit template. May be
null.pageIdintThe ID of the page hosting the UserAddresses module (typically
Pageview.Page.ID).
Returns
- string
A URL like
/?ID={pageId}&Cmd=SaveAddress&AddressId={model.Address.Id}whenmodelis notnull.
Remarks
Use this as the action of your edit form for create/update. This is a safe accessor — it returns null
if the model itself is null. The method always includes the current AddressId.