Search Results

Search found 2 results on 1 pages for 'redbluegreen'.

Page 1/1 | 1 

  • entity framework inserting a many-to-many relationship between two existing objects while updating

    - by redbluegreen
    I'm trying to do this: using(var context = new SampleEntities()) { User user = select a user from database; //Update user's properties user.Username = ... user.Website = ... //Add a role Role role = select a role from database //trying to insert into table UserRoles which has columns (UserID, RoleID) user.Roles.Add(role); //Apply property changes context.ApplyPropertyChanges("Users", user); context.SaveChanges(); } However, I get an exception telling me that "The existing object in the ObjectContext is in the Added state" and can't "ApplyPropertyChanges". If "ApplyPropertyChanges()" is removed, it adds a User. What orders should these methods be called? I don't need to do them separately right? Thanks.

    Read the article

  • Using jquery ui dialog to confirm action for form submission

    - by redbluegreen
    I have multiple forms on a page, for each of them I want the user to confirm before form submission. but when the user confirms to submit, how do I let this dialog know which form the user is sumbitting? Does it take custom parameters? Thanks. $("#dialog-confirm").dialog({ resizable: false, height:140, modal: true, buttons: { 'Confirm submit': function() { document.______???????_____.submit(); }, Cancel: function() { $(this).dialog('close'); } } }); $('.allForms').submit(function(){ $('#dialog-confirm').dialog('open'); });

    Read the article

1