public IActionResult RemoveLanguageFromPerson(int pId, int langId)
        {
            Person person = _service.FindBy(pId);

            if (person == null)
            {
                return(RedirectToAction("Index"));
            }

            _personLanguageService.Remove(pId, langId);

            return(RedirectToAction("UpdatePersonLanguages", new { id = pId }));
        }
Beispiel #2
0
        public IActionResult PersonLanguageRemove(int personId, int languageId)
        {
            PersonLanguage pl = _personLanguageService.FindbyId(personId, languageId);

            if (pl == null)
            {
                return(RedirectToAction("Index"));
            }

            bool result = _personLanguageService.Remove(personId, languageId);

            if (result)
            {
                return(RedirectToAction("LanguageManagement", new { id = personId }));
            }

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public Person Edit(int id, Person editPerson)
        {
            Person person = FindBy(id);

            person.FirstName   = editPerson.FirstName;
            person.LastName    = editPerson.LastName;
            person.PhoneNumber = editPerson.PhoneNumber;
            person.Address     = editPerson.Address;
            pr.Update(person);

            List <PersonLanguage> matchingPersonLangList = _personLangservice.FindBy(id);

            foreach (PersonLanguage personLang in matchingPersonLangList)
            {
                _personLangservice.Remove(personLang);
            }
            foreach (int languageID in editPerson.ListLanguageID)
            {
                _personLangservice.Add(id, languageID);
            }
            return(person);
        }