public static int SaveExam(BankStoryExam Exam)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.BankStoryExams.ApplyChanges(Exam);
             ctx.SaveChanges();
             return Exam.ExamId;
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("BankStory_DataProvider_SaveExam", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
        private BankStoryExam GetPollInfoFromSkin()
        {
            BankStoryExam p = new BankStoryExam
                 {
                     ExamName = txtExamName.Text,
                     Description = txtExamDescription.Text,
                     DurationTime = txtExamDuration.Text.ToInt32(),
                     IsActiveFromDate = ucActiveFromDate.SelectedDateTime.Value,
                     IsActiveToDate = ucActiveToDate.SelectedDateTime.Value,
                     ScoreTypeId = drpScoreTypeId.SelectedValue.ToInt32(),
                     CreateDateTime = DateTime.Now,

                 };

            return p;

        }
     private void FixupBankStoryExam(BankStoryExam previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.BankStoryExam_Question.Contains(this))
         {
             previousValue.BankStoryExam_Question.Remove(this);
         }
 
         if (BankStoryExam != null)
         {
             if (!BankStoryExam.BankStoryExam_Question.Contains(this))
             {
                 BankStoryExam.BankStoryExam_Question.Add(this);
             }
 
             ExamId = BankStoryExam.ExamId;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("BankStoryExam")
                 && (ChangeTracker.OriginalValues["BankStoryExam"] == BankStoryExam))
             {
                 ChangeTracker.OriginalValues.Remove("BankStoryExam");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("BankStoryExam", previousValue);
             }
             if (BankStoryExam != null && !BankStoryExam.ChangeTracker.ChangeTrackingEnabled)
             {
                 BankStoryExam.StartTracking();
             }
         }
     }