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);
     }
 }
        /// <summary>
        /// Creates a new languageProficiency in the ECA system.
        /// </summary>
        /// <param name="languageProficiency">The languageProficiency.</param>
        /// <returns>The created languageProficiency entity.</returns>
        public async Task <PersonLanguageProficiency> CreateAsync(NewPersonLanguageProficiency languageProficiency)
        {
            var person = await this.Context.People.FindAsync(languageProficiency.PersonId);

            if (languageProficiency.IsNativeLanguage)
            {
                await SetAllLanguagesNotNativeAsync(languageProficiency.PersonId, languageProficiency.LanguageId);
            }
            return(DoCreate(languageProficiency, person));
        }
        /// <summary>
        /// Creates a new languageProficiency in the ECA system.
        /// </summary>
        /// <param name="languageProficiency">The languageProficiency.</param>
        /// <returns>The created languageProficiency entity.</returns>
        public PersonLanguageProficiency Create(NewPersonLanguageProficiency languageProficiency)
        {
            var person = this.Context.People.Find(languageProficiency.PersonId);

            if (languageProficiency.IsNativeLanguage)
            {
                SetAllLanguagesNotNative(languageProficiency.PersonId, languageProficiency.LanguageId);
            }
            return(DoCreate(languageProficiency, person));
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="languageProficiency"></param>
 /// <returns></returns>
 public PersonLanguageProficiency Create(NewPersonLanguageProficiency newPersonLanguageProficiency)
 {
     Contract.Requires(newPersonLanguageProficiency != null, "The newPersonLanguageProficiency entity must not be null.");
     Contract.Ensures(Contract.Result <PersonLanguageProficiency>() != null, "The PersonLanguageProficiency entity returned must not be null.");
     return(null);
 }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="languageProficiency"></param>
 /// <returns></returns>
 public Task <PersonLanguageProficiency> CreateAsync(NewPersonLanguageProficiency newPersonLanguageProficiency)
 {
     Contract.Requires(newPersonLanguageProficiency != null, "The newPersonLanguageProficiency entity must not be null.");
     Contract.Ensures(Contract.Result <Task <PersonLanguageProficiency> >() != null, "The PersonLanguageProficiency entity returned must not be null.");
     return(Task.FromResult <PersonLanguageProficiency>(null));
 }
 private PersonLanguageProficiency DoCreate(NewPersonLanguageProficiency languageProficiency, Person person)
 {
     throwIfPersonEntityNotFound(person, languageProficiency.PersonId);
     return(languageProficiency.AddPersonLanguageProficiency(person));
 }