public IActionResult PersonLanguageAdd(int personId, int languageId) { Person person = _peopleService.FindBy(personId); Language l = _languageService.FindbyId(languageId); if (person != null || l != null) { PersonLanguage personLanguage = _personLanguageService.Add(personId, languageId); return(RedirectToAction("LanguageManagement", new { id = personId })); } return(RedirectToAction("Index")); }
public IActionResult AddLanguageToPerson(int personId, int langId) { Person person = _peopleService.FindbyId(personId); if (person == null) { return RedirectToAction("Index"); } PersonLanguage personLanguage = _personLanguageService.Add(// Ă„ndra till Service new PersonLanguage() { PersonId = personId, LanguageId = langId }); return RedirectToAction("ManagePersonLanguages", new { id = personId }); }
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); }