private void DoUpdate(UpdatedPersonLanguageProficiency updatedLanguageProficiency, PersonLanguageProficiency modelToUpdate)
 {
     Contract.Requires(updatedLanguageProficiency != null, "The updatedLanguageProficiency must not be null.");
     throwIfLanguageProficiencyNotFound(modelToUpdate, updatedLanguageProficiency.LanguageId);
     if (updatedLanguageProficiency.NewLanguageId.HasValue && updatedLanguageProficiency.NewLanguageId != modelToUpdate.LanguageId)
     {
         DoDelete(modelToUpdate);
         User user = updatedLanguageProficiency.Update.User;
         var  newLanguageProficiency = new NewPersonLanguageProficiency(updatedLanguageProficiency.Update.User, updatedLanguageProficiency.PersonId, updatedLanguageProficiency.NewLanguageId.Value,
                                                                        updatedLanguageProficiency.IsNativeLanguage, updatedLanguageProficiency.SpeakingProficiency, updatedLanguageProficiency.ReadingProficiency, updatedLanguageProficiency.ComprehensionProficiency);
         var person = Context.People.Find(updatedLanguageProficiency.PersonId);
         var temp   = DoCreate(newLanguageProficiency, person);
     }
     else
     {
         modelToUpdate.LanguageId               = (updatedLanguageProficiency.NewLanguageId.HasValue) ? updatedLanguageProficiency.NewLanguageId.Value : updatedLanguageProficiency.LanguageId;
         modelToUpdate.IsNativeLanguage         = updatedLanguageProficiency.IsNativeLanguage;
         modelToUpdate.SpeakingProficiency      = updatedLanguageProficiency.SpeakingProficiency;
         modelToUpdate.ReadingProficiency       = updatedLanguageProficiency.ReadingProficiency;
         modelToUpdate.ComprehensionProficiency = updatedLanguageProficiency.ComprehensionProficiency;
         updatedLanguageProficiency.Update.SetHistory(modelToUpdate);
     }
     if (updatedLanguageProficiency.IsNativeLanguage)
     {
         SetAllLanguagesNotNative(updatedLanguageProficiency.PersonId, updatedLanguageProficiency.LanguageId);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="updatedLanguageProficiency"></param>
 /// <returns></returns>
 public Task UpdateAsync(UpdatedPersonLanguageProficiency updatedLanguageProficiency)
 {
     Contract.Requires(updatedLanguageProficiency != null, "The updated updatedLanguageProficiency must not be null.");
     return(Task.FromResult <object>(null));
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="updatedLanguageProficiency"></param>
 public void Update(UpdatedPersonLanguageProficiency updatedLanguageProficiency)
 {
     Contract.Requires(updatedLanguageProficiency != null, "The updated updatedLanguageProficiency must not be null.");
 }
        /// <summary>
        /// Updates the ECA system's LanguageProficiency data with the given updated updatedLanguageProficiency.
        /// </summary>
        /// <param name="updatedLanguageProficiency">The updated LanguageProficiency.</param>
        public async Task UpdateAsync(UpdatedPersonLanguageProficiency updatedLanguageProficiency)
        {
            var languageProficiency = await Context.PersonLanguageProficiencies.FindAsync(updatedLanguageProficiency.LanguageId, updatedLanguageProficiency.PersonId);

            DoUpdate(updatedLanguageProficiency, languageProficiency);
        }
        /// <summary>
        /// Updates the ECA system's languageProficiency data with the given updated languageProficiency.
        /// </summary>
        /// <param name="updatedLanguageProficiency">The updated languageProficiency.</param>
        public void Update(UpdatedPersonLanguageProficiency updatedLanguageProficiency)
        {
            var languageProficiency = Context.PersonLanguageProficiencies.Find(updatedLanguageProficiency.LanguageId, updatedLanguageProficiency.PersonId);

            DoUpdate(updatedLanguageProficiency, languageProficiency);
        }