Add / Edit plans with custom fields
Hello all,
I am trying to add plans with cusotm fields. So I have 2 tables for this
1. Plans 2. CustomFields
In the UI part I have basic information for plans table like (Name, Description) and other part is for custom fileds which is Name & Value.
Now when a plan will be saved then all custom fields will be saved for that plan in CustomFields table.
How I can do this in one server hit.
How do I manage EDMX classes so that all work is done in one go.
I could do this in this manner,
On UI, first send request to add plan, and get inserted plan id. Then make another request with plan id in hand and name, value collection of custom fields.
But I do not want to do this way, all I want is save all data in one go.
Second thing,
When editing a specific plan, I do not want to delete all associated custom fields with plan and then re add them. If any of the custom field is deleted from UI only then it
should be deleted from DB, otherwise not.In other case it (custom field) should just be updated.
Please tell me how it can be done in the requested way.
(I do not like the way I've been following to do such operations, so please tell me with code samples how I can achieve this in requested way.)
Many thanks
|