Problem Use SfDataManager in Sfgrid with CRUD action in 2 DTO's

Hi,

I have to create a CRUD application on customers that has to use an existing API.

The API has 2 different DTO's.

- One for list: CustomerListDTO: implements all fields of the Customer table and a lot of fields of oter tables (not implemented in my sample).

   public class CustomerListDTO

    {

        public long CustomerId { get; set; }

        public string? Name { get; set; }

    }

- One for update, insert: here are annotations in it, for validation of a new created, updated customer. Also 2 secret fields have to be filled. Those fields are not visible in the CustomerListDTO. Only the persons that can add or update data can see those fields.

    public class CustomerUpSertDTO

    {

        public long CustomerId { get; set; }

        [Required(ErrorMessage = "Name field is required")]

        public string? Name { get; set; }

        [Required(ErrorMessage = "SecretOne field is required")]

        public string? SecretOne { get; set; }

        [Required(ErrorMessage = "SecretTwo field is required")]

        public string? SecretTwo { get; set; }

    }

I can create my SfGrid component, but how can i make it possible that it is showing the list with the 'CustomerListDTO' and uses the 'CustomerUpSertDTO'  for inserting, Updating a customer (and takes the annotations i. The problem is that i connot modify the API calls. It is an external company that has written these apis...

See my example in attachment.

Can you help please

Thanks

Chris Vandewiele


 



Attachment: BlazorAppCRUDTwoDTO_d84f902e.zip

Loader.
Up arrow icon