Skip to content

Latest commit

 

History

History
39 lines (37 loc) · 2.24 KB

README.md

File metadata and controls

39 lines (37 loc) · 2.24 KB

radzen-end-to-end-application in less than 10 min.

  1. Create a new Radzen application.
  2. Create a new SQL Server data source and press Create sample schema. Generate CRUD pages from the data source.
  3. Enable security and generate security pages.
  4. Delete the Edit Order Detail and Order Details pages.
  5. Open the Edit Order page.
    1. Select the Form component and delete teh User Name field.
    2. Add a DataGrid component and bind it to the getOrderDetails data source method with $filter parameter set to OrderId eq ${parameters.Id} and $expand set to Product.
    3. Autogenerate the columns.
    4. Set the Template of the Product Id column to ${data.Product?.ProductName}. Set the Title to Product.
    5. Check the AllowAdd DataGrid property.
    6. Check the AllowDelete DataGrid property.
    7. Handle the DataGrid Add event and open Add Order Detail as a dialog with parameter OrderId set to ${parameters.Id}
    8. Handle the DataGrid Delete event and invoke the deleteOrderDetail method with parameter Id set to ${event.Id}.
  6. Open Add Order Detail page.
    1. Select the form component and remove the Order field.
    2. Go to the Events tab in the property grid. Replace the ${event} value of the submit event parameter with Object.assign(${event}, {OrderId: ${parameters.OrderId}}).
    3. Add a Then action that navigates back.
  7. Open the Add Order page, select the form component and remove the User Name field.
  8. Open the Edit Order page, select the form component and remove the User Name field.
  9. Run. Open an order and add order detail. Stop to customize the generated code.
  10. Open generated application with your favorite edtor and add a new file called OrdersController.custom.cs next to OrdersController.cs:
    using System.Security.Claims;
    using [APPLICATION_NAME].Models.[DATASOURCE_NAME];
    
    namespace [APPLICATION_NAME].Controllers.[DATASOURCE_NAME]
    {
        public partial class OrdersController
        {
            partial void OnOrderCreated(Order item)
            {
                item.UserName = this.HttpContext.User.FindFirst(ClaimTypes.Name).Value;
            }
        }
    }
  11. Run application