lundi 4 janvier 2016

CRUD operations with multiple lists in view model

I have a view model that has multiple lists that I want users to administer from a single screen. Here is my view model:

    public int EmployerId { get; set; }
    public string EmailAddress { get; set; }
    public string Password { get; set; }
    public bool IsEnabled { get; set; }
    public string SecurityQuestionAnswer { get; set; }

    public List<BillData> BillingIds { get; set; }
    public List<GroupAccess> Groups { get; set; } 

The goal is to allow CRUD operations for email address, pwd, etc.. as well as the 2 lists. When a user saves, all of the data will post to the controller, saving all of the data. I can't find a way to do this without editing the 2 lists in another view and commiting to the database. I've looked at several grid components but they also commit the lists individually, not tying to the view model.

I want the view to allow CRUD operations for all data elements from the same screen and the updated viewmodel to be returned to the controller for saving.

How would you do something like this without going to another view?

Aucun commentaire:

Enregistrer un commentaire