Blazor Server - Order management system

Cenk 956 Reputation points
2022-06-28T20:27:20.137+00:00

Hello guys,

I am very new to Blazor and trying to implement a simple order management system with ASP.NET Core Blazor Server.

In the core business, there will be orders, order details, vendors, and customers entities. Certain business rules are, that there will be adding, updating, listing, and soft deletion for all entities. Orders can also be added to the database via excel import. Generating PDFs based on vendors for every single order. (An order can have multiple order details - product id, product name, vendor, shipment number, order amount, cost, status etc.) For importing orders/order details via excel, how should I design classes/models? After excel import (orders/order details data can be 15 columns) how can I fit all of the columns (or any other ideas) on the page? And last but not least, there should be roles for the users in order to do some operations like editing or adding. Is there a way to authorize users based on data? Let's say after excel import, x role user can update the status of the order detail but can not soft delete the order detail, etc.

It's a bit confusing, but I hope I can explain what I need in general. I think you can guide me on this journey.

Thanks in advance.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,383 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,366 Reputation points
    2022-06-28T22:11:10.337+00:00

    a lot will depend on the database technology you pick. once you pick one, you should see their best practices for implementing row permissions.

    once you have chosen the database, then you should define the data layer api. This will help design the api parameters and model (separate from the database entities.

    as you plan on pdf, you will need to select a pdf generation library

    review asp.net security to understand roles and authorization. then apply to the data api.

    as you want to do excel import, you will need to select an excel parsing library.

    0 comments No comments

  2. Cenk 956 Reputation points
    2022-06-29T05:03:30.053+00:00

    Hi @Bruce (SqlWork.com) , I am planning to use SQL express 2019. Can you explain a little more with an example? Thank you.

    0 comments No comments

  3. Zhi Lv - MSFT 32,011 Reputation points Microsoft Vendor
    2022-06-29T06:47:31.647+00:00

    Hi @Cenk ,

    Your question is too broad, so I can just give some suggestions, you can refer to them and have a try, if you meet any issue when developing the application, please feel free to post in this forum.

    For importing orders/order details via excel, how should I design classes/models?

    It depends on your needs and excel data, since the entities contain relationship, you could refer to the following tutorial to configure relationship between the entities:

    EF Core Relationships

    Configuring One To Many Relationships in Entity Framework Core

    Then, when insert/load the related entities, you can use the navigation property. Refer to the following article to load the related entities:

    EF Core Loading Related Data

    Eager Loading of Related Data

    After creating the model, you can refer to the following link to implement the CRUD operations:

    Blazor Server App CRUD With Entity Framework Core In .Net 5

    After excel import (orders/order details data can be 15 columns) how can I fit all of the columns (or any other ideas) on the page?

    To load all related entity's property, you can use the navigation property. Or you can create a View Model, which contains all the required properties for a view.

    And last but not least, there should be roles for the users in order to do some operations like editing or adding. Is there a way to authorize users based on data?

    Refer to the Secure ASP.NET Core Blazor Server apps and use the Scaffold Identity into a Blazor Server project, after that you can use the Asp.net Core Identity to achieve the Role-Based Authorization.

    You can also search "How to implement role based authorization in Blazor Server" using Google or Bing, there are multiple tutorials or sample online.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments

  4. Cenk 956 Reputation points
    2022-06-29T07:36:38.163+00:00

    @Zhi Lv - MSFT Thank you.

    What are the advantages and disadvantages of having order and order details entities over only one entity?