diff --git a/how-to/buttons-links/transactions.md b/how-to/buttons-links/transactions.md index 1adae0c..e1ead75 100644 --- a/how-to/buttons-links/transactions.md +++ b/how-to/buttons-links/transactions.md @@ -1,6 +1,6 @@ # Transactions -Each button is associated with a series of workflows which are defined by chaining the button method with OnClick method. By default these workflows are executed in one transaction scope so in case of any runtime error all the previous steps can be rolled back. In some scenarios executing all the steps in the workflow is not desirable for example when we are registering a new user and we need to send an email to the user in order to confirm the user's email address. We need to send the confirmation email after successful storage of the user’s information and we don’t want the record deletion in case of email dispatch failure, therefore we must instruct M# to execute each of the workflow’s steps on different scope, to do so we use RunInTransaction(false) method. +Each button is associated with a series of workflows which are defined by chaining the button method with OnClick method. By default these workflows are executed in one transaction scope so in case of any runtime error all the previous steps can be rolled back. In some scenarios executing all the steps in the workflow is not desirable for example when we are registering a new user and we need to send an email to the user in order to confirm the user's email address. We need to send the confirmation email after successful storage of the user’s information and we don’t want the record deletion in case of email dispatch failure, therefore we must instruct M# to execute each of the workflow’s steps on different scope, to do so we use `RunInTransaction(false)` method. ```csharp @@ -28,14 +28,14 @@ namespace Modules Button("Cancel").OnClick(x => x.ReturnToPreviousPage()); Button("Save").IsDefault().Icon(FA.Check) - .OnClick(x => - { - x.RunInTransaction(false); - x.SaveInDatabase(); - x.CSharp("info.Item.SendConfirmation();"); - x.Display("Saved successfully.") - .DisplayOnModule(); - }); + .OnClick(x => + { + x.RunInTransaction(false); + x.SaveInDatabase(); + x.CSharp("info.Item.SendConfirmation();"); + x.Display("Saved successfully.") + DisplayOnModule(); + }); } } } diff --git a/how-to/buttons-links/trigering-skipping-validation.md b/how-to/buttons-links/trigering-skipping-validation.md index eb2a2fc..3e04b86 100644 --- a/how-to/buttons-links/trigering-skipping-validation.md +++ b/how-to/buttons-links/trigering-skipping-validation.md @@ -1,6 +1,6 @@ # Trigering/skipping validation -When working on M# form modules sometimes we need to allow the user to complete the form partially or without accurate input, for example when developing the form and we just need some dummy data for testing purposes. In order to instruct M# To lift any validations’ defined on the entity we should chain the Button method with the CauseValidation and enter false for its first argument. +When working on M# form modules sometimes we need to allow the user to complete the form partially or without accurate input, for example when developing the form and we just need some dummy data for testing purposes. In order to instruct M# to lift any validations’ defined on the entity we should chain the Button method with the `CauseValidation` and enter false for its first argument. @@ -21,15 +21,15 @@ namespace Modules Button("Cancel").OnClick(x => x.ReturnToPreviousPage()); Button("Save") - .IsDefault() - .Icon(FA.Check) - .CausesValidation(false) - .OnClick(x => - { - x.SaveInDatabase(); - x.GentleMessage("Saved successfully."); - x.Go(); - }); + .IsDefault() + .Icon(FA.Check) + .CausesValidation(false) + .OnClick(x => + { + x.SaveInDatabase(); + x.GentleMessage("Saved successfully."); + x.Go(); + }); } } } diff --git a/how-to/list-modules/exportToCsvExcel.md b/how-to/list-modules/exportToCsvExcel.md index 7a0ca8c..8f3cf2e 100644 --- a/how-to/list-modules/exportToCsvExcel.md +++ b/how-to/list-modules/exportToCsvExcel.md @@ -24,4 +24,4 @@ If you wish you can change the file name to something more appropriate using Com ``` -On clicking this button the User will download file “My Contacts”, this will be an excel or csv file with all the data and layout of the list visible in the browser window, including any active search filters. +By clicking on this button the User will download file “My Contacts”, this will be an excel or csv file with all the data and layout of the list visible in the browser window, including any active search filters. diff --git a/how-to/list-modules/manualSorting.md b/how-to/list-modules/manualSorting.md index 8a6c96b..409f32b 100644 --- a/how-to/list-modules/manualSorting.md +++ b/how-to/list-modules/manualSorting.md @@ -62,9 +62,9 @@ To do this, add a method GetSiblings() to the Domain Logic for your Entity. This method must: -- be called GetSiblings -- be public -- return a Task which returns an Enumerable of your Entity +- Be called GetSiblings +- Be public +- Return a Task which returns an Enumerable of your Entity If this method exists MSharp will automatically use it to only apply unique order to siblings. diff --git a/how-to/list-modules/sorting.md b/how-to/list-modules/sorting.md index 379399e..51dccf6 100644 --- a/how-to/list-modules/sorting.md +++ b/how-to/list-modules/sorting.md @@ -26,6 +26,6 @@ In this example, Products are sorted by Category in reverse alphabetical order a This causes the following code to be generated in the GetSource method of the controller ```csharp - result = result.OrderByDescending(item => item.Wearer) + result = result.OrderByDescending(item => item.Category) .ThenBy(item => item.WeightInKg); ``` diff --git a/how-to/menus/creatingMenu.md b/how-to/menus/creatingMenu.md index e66b148..1afaa50 100644 --- a/how-to/menus/creatingMenu.md +++ b/how-to/menus/creatingMenu.md @@ -46,15 +46,15 @@ namespace Modules There are many methods which can be applied to the menu, here extra CSS classes have been added for styling. -Useful Methods for Items include: +Useful methods for items include: -- OnClick(): Determines the destination of the link +- `OnClick()`: Determines the destination of the link -- VisibleIf() : especially useful with AppRole allowing for a different user experience depending on the role of the User. +- `VisibleIf()`: Especially useful with AppRole allowing for a different user experience depending on the role of the User. -- Icon(FA icon) or Icon(string value): to add an icon to the button, M# natively supports Font Awesome. +- `Icon(FA icon)` or `Icon(string value)`: to add an icon to the button, M# natively supports Font Awesome. -Once created the Menu can be Set() on any Pages you want, the use of root pages is very useful in this endeavour. +Once created, the Menu can be `Set()` on any pages you want, the use of root pages is very useful in this endeavour. ```csharp @@ -67,4 +67,4 @@ Once created the Menu can be Set() on any Pages you want, the use of root pages ``` -PageSettings include TopMenu, LeftMenu and SubMenu which provide simple styling as standard but you can add your own if you fancy a challenge. +`PageSettings` include `TopMenu`, `LeftMenu` and `SubMenu` which provide simple styling as standard but you can add your own if you fancy a challenge. diff --git a/how-to/menus/dynamicMenuItems.md b/how-to/menus/dynamicMenuItems.md index 24260ac..168325e 100644 --- a/how-to/menus/dynamicMenuItems.md +++ b/how-to/menus/dynamicMenuItems.md @@ -19,21 +19,21 @@ For example, separate menu links go to pages that display foods which satisfy di ``` - Create a new item for your menu and give it a Name. -- By specifying the DataSourceType() as DietType, the menu is populated with one link for every Diet Type in the database. If you do not want every instance to be used you can specify a DataSource() instead. +- By specifying the `DataSourceType()` as DietType, the menu is populated with one link for every Diet Type in the database. If you do not want every instance to be used you can specify a `DataSource()` instead. - The text of the menu link will need to be written dynamically using `c#:` -- Key is used to give each dynamically created menu link a unique identifier, which is necessary for menu item highlighting to work. -- When you navigate using this item you must Send() the `item.ID` so you are able to generate the appropriate content on the destination page. +- `Key` is used to give each dynamically created menu link a unique identifier, which is necessary for menu item highlighting to work. +- When you navigate using this item you must `Send()` the `item.ID` so you are able to generate the appropriate content on the destination page. ### Custom Menu Item Highlighting MSharp's menu item highlighting is performed automatically by matching the urls with the menu item's link, however when using dynamic menu items you will need to add an extra rule based on the key as they all link to the same page. -Add a SpecialSelectedKeyRule() to the Menu above its items. +Add a `SpecialSelectedKeyRule()` to the Menu above its items. ```csharp SpecialSelectedKeyRule("if(Request.Has(\"category\")) return Request.Query[\"category\"];"); ``` -This checks to see whether a query string "category" has been passed and if it has, it uses this categories value to determine what menu items Key it corresponds to. +This checks to see whether a query string "category" has been passed and if it has, it uses this category value to determine what menu items `Key` it corresponds to. ### In the destination Module: @@ -42,8 +42,7 @@ This checks to see whether a query string "category" has been passed and if it h { HeaderText("c#: info.Category == null ? \"Food\" : info.Category.Name") .SourceCriteria("info.Category == item.Category") - .SourceEvaluationCriteria("info.Category!=null"); - + .SourceEvaluationCriteria("info.Category != null"); ViewModelProperty("DietType", "Category") .FromRequestParam("category"); @@ -54,8 +53,8 @@ This checks to see whether a query string "category" has been passed and if it h } ``` -- Create a new ViewModelProperty “Category” of type “DietType” from the query string “category”. +- Create a new `ViewModelProperty` “Category” of type “DietType” from the query string “category”. - The header text can be made dynamic to match the menu item. Here, there is a general heading for if there is no query string received. -- The date source can be filtered using SourceCriteria(). Only items whose category matches the view model property Category will be shown. -- To avoid exceptions in the event that there is no category received, use SourceEvaluationCriteria(). If there is no info.Category then it skips SourceCriteria() and displays all results. +- The date source can be filtered using `SourceCriteria()`. Only items whose category matches the view model property Category will be shown. +- To avoid exceptions in the event that there is no category received, use `SourceEvaluationCriteria()`. If there is no `info.Category` then it skips `SourceCriteria()` and displays all results. diff --git a/how-to/navigation/modal-PopUp.md b/how-to/navigation/modal-PopUp.md index 4877e7d..77a15f8 100644 --- a/how-to/navigation/modal-PopUp.md +++ b/how-to/navigation/modal-PopUp.md @@ -39,7 +39,7 @@ public ContactsList() } ``` -3) When Navigating away from the pop up, make sure the Modal is closed instead of being redirected +3) When navigating away from the pop up, make sure the Modal is closed instead of being redirected ```csharp public ContactForm() @@ -54,12 +54,12 @@ public ContactForm() .OnClick(x => x.CloseModal()); Button("Save").IsDefault().Icon(FA.Check) - .OnClick(x => - { - x.SaveInDatabase(); - x.GentleMessage("Saved successfully."); - x.CloseModal(Refresh.Ajax); - }); + .OnClick(x => + { + x.SaveInDatabase(); + x.GentleMessage("Saved successfully."); + x.CloseModal(Refresh.Ajax); + }); } ``` diff --git a/how-to/search/customSearchElement.md b/how-to/search/customSearchElement.md index d053b67..0608e86 100644 --- a/how-to/search/customSearchElement.md +++ b/how-to/search/customSearchElement.md @@ -54,7 +54,7 @@ namespace ViewModel } ``` -- `MemoryFilterCode()` - Insert the code to control the search functionality. Use info. to refer to the filter properties generated above. This code is also generated in the Controller, in the GetSource() method: +- `MemoryFilterCode()` - Insert the code to control the search functionality. Use `info.` to refer to the filter properties generated above. This code is also generated in the Controller, in the `GetSource()` method: ```csharp async Task> GetSource(vm.GadgetsList info) diff --git a/how-to/uiComposition/viewComponents.md b/how-to/uiComposition/viewComponents.md index b8db1e6..3aaa969 100644 --- a/how-to/uiComposition/viewComponents.md +++ b/how-to/uiComposition/viewComponents.md @@ -30,7 +30,7 @@ When you add a module to multiple pages MSharp removes the module’s code from } ``` -Now Msharp will generate all the necessary controllers and bindings without it needing to be explicitly added to a page in the UI. ViewComponent controllers are generated in Website>Views>Modules>Components. +Now MSharp will generate all the necessary controllers and bindings without it needing to be explicitly added to a page in the UI. ViewComponent controllers are generated in Website > Views > Modules > Components. Now it can instead be invoked from a Layout page or from inside Markup. @@ -38,6 +38,6 @@ Now it can instead be invoked from a Layout page or from inside Markup.
@await Component.InvokeAsync(typeof(Footer))
``` View Components are particularly suited to -- Dynamic Menus -- Login Panels +- Dynamic menus +- Login panels - Shopping carts diff --git a/how-to/uiComposition/visibility.md b/how-to/uiComposition/visibility.md index f24877d..592a260 100644 --- a/how-to/uiComposition/visibility.md +++ b/how-to/uiComposition/visibility.md @@ -10,9 +10,9 @@ This allows for more dynamic content and less repetition of code. Visibility can be changed on a variety of elements, including columns, buttons, menu items and whole modules. -VisibleIf() can be invoked by writing the desired code in a string, this code is then generated in the Cshtml file. +`VisibleIf()` can be invoked by writing the desired code in a string, this code is then generated in the Cshtml file. -Often you want to limit visibility based on the Users role, in this case you can invoke VisibleIf() using AppRole. +Often you want to limit visibility based on the Users role, in this case you can invoke `VisibleIf()` using `AppRole`. ## Examples @@ -24,7 +24,7 @@ If a Contacts List is filtered by query string “category” the Category colum Column(x => x.Category).VisibleIf("info.Category == null"); ``` -To only effect the visibility of certain cells in a column, depending on item, use CellVisibleIf(). +To only effect the visibility of certain cells in a column, depending on item, use `CellVisibleIf()`. ### Using AppRole @@ -50,4 +50,4 @@ Only Admin Users can view the button column, a button should only be visible if .OnClick(x => x.Go().Send("item", "item.ID")); ``` -On a button column VisibleIf() affects the visibility of the individual buttons, so to hide the column use ColumnVisibleIf(). \ No newline at end of file +On a button column `VisibleIf()` affects the visibility of the individual buttons, so to hide the column use `ColumnVisibleIf()`. \ No newline at end of file