Exemple #1
0
        public void SaveButton(Button button)
        {
            if (button.ButtonID == 0)
            {
                context.Buttons.Add(button);
            }
            else
            {
                context.Entry(button).State = EntityState.Modified;
            }

             bool saveFailed = true;

             while (saveFailed)
             {
                 saveFailed = false;
                 try
                 {
                     context.SaveChanges();
                 }
                 catch (DbUpdateConcurrencyException ex)
                 {
                     saveFailed = true;

                     // Reload with StoreWins
                     ex.Entries.Single().Reload();
                 }
                 catch (Exception ex)
                 {
                     throw ex;
                 }
             }
        }
Exemple #2
0
 public void DeleteButton(Button button)
 {
 }