Example #1
0
        public bool Update(int id, PersonViewModel personViewModel)
        {
            People people = VM_ToDrink(personViewModel);

            people.Id = id;
            return(_personsRepo.Update(people));
        }
        public Person Edit(int id, Person person)
        {
            Person editPerson = new Person()
            {
                Id = id, Name = person.Name, PhoneNumber = person.PhoneNumber, City = person.City
            };

            return(_peopleRepo.Update(editPerson));
        }
Example #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);
            return(person);
        }
Example #4
0
        public Person Edit(int id, CreatePersonViewModel person)
        {
            if (person.ShouseLanguage != null)
            {
                Person persons = new Person();
                persons.Languages = new List <PersonLanguage>();

                foreach (var language in person.ShouseLanguage)
                {
                    Language lang = _languageService.FindBy(language);

                    PersonLanguage langID = new PersonLanguage()
                    {
                        LanguageID = lang.Id, Language = lang
                    };
                    persons.Languages.Add(langID);
                }
                // PersonLanguage pl = new PersonLanguage();

                Person editPerson = new Person()
                {
                    Id = id, Name = person.Name, City = person.City, Country = person.Country, PhoneNumber = person.PhoneNumber, Languages = persons.Languages
                };

                return(_peopleRepo.Update(editPerson));

                throw new NotImplementedException();
            }
            else
            {
                Person editPerson = new Person()
                {
                    Id = id, Name = person.Name, City = person.City, Country = person.Country, PhoneNumber = person.PhoneNumber
                };

                return(_peopleRepo.Update(editPerson));
            }
        }
Example #5
0
        public Person Edit(int id, Person person)
        {
            Person _person = FindBy(id);

            if (_person == null)
            {
                return(null);
            }

            _person.Name  = person.Name;
            _person.Phone = person.Phone;
            _person.LiveInCity.CityName = person.LiveInCity.CityName;

            _person = _peopleRepo.Update(_person);
            return(_person);
        }
Example #6
0
        public Person Edit(int id, EditPersonViewModel person)
        {
            Person personToUpdate = FindBy(id);

            if (personToUpdate == null)
            {
                return(null);
            }

            personToUpdate.Id        = id;
            personToUpdate.FirstName = person.CreatePerson.FirstName;
            personToUpdate.LastName  = person.CreatePerson.LastName;
            personToUpdate.InCityId  = person.CreatePerson.CityId;
            personToUpdate.PhoneNr   = person.CreatePerson.PhoneNr;

            return(_memory.Update(personToUpdate));
        }
        public Person Edit(int id, CreatePerson person)
        {
            Person originPerson = FindById(id);

            if (originPerson == null)                                   // No person to update -- not even the "origin" person
            {
                return(null);
            }

            originPerson.Name     = person.Name;
            originPerson.InCityId = person.InCityId;
            originPerson.Phone    = person.Phone;

            originPerson = _peopleRepo.Update(originPerson);

            return(originPerson);
        }
Example #8
0
        public Person Edit(int id, CreatePersonViewModel createPerson)
        {
            Person person = FindbyId(id);

            if (person == null)
            {
                return(null);
            }

            person.Id       = id;
            person.Name     = createPerson.Name;
            person.Phone    = createPerson.Phone;
            person.InCityId = createPerson.CityId;


            return(_peopleRepo.Update(person));
        }
        public Person EditPerson(int id, CreatePersonViewModel createPerson)
        {
            Person originalPerson = FindBy(id);

            if (originalPerson == null)
            {
                return(null);
            }

            originalPerson.Name        = createPerson.Name;
            originalPerson.PhoneNumber = createPerson.PhoneNumber;
            originalPerson.CityId      = createPerson.CityId;
            //originalPerson.CountryName = createPerson.CountryName;

            originalPerson = _peopleRepo.Update(originalPerson);

            return(originalPerson);
        }
Example #10
0
        public Person Edit(int id, EditPersonViewModel createPerson)
        {
            Person OrgP = FindById(id);

            if (OrgP == null)
            {
                return(null);
            }
            OrgP.Id          = createPerson.Id;
            OrgP.FirstName   = createPerson.CreatePerson.FirstName;
            OrgP.LastName    = createPerson.CreatePerson.LastName;
            OrgP.InCityId    = createPerson.CreatePerson.CityId;
            OrgP.PhoneNumber = createPerson.CreatePerson.PhoneNumber;

            _personRepo.Update(OrgP);

            return(OrgP);
        }
Example #11
0
        public Person Edit(int id, CreatePerson createPerson)
        {
            Person originalPerson = FindById(id);

            if (originalPerson == null)
            {
                return(null);
            }

            originalPerson.FirstName       = createPerson.FirstName;
            originalPerson.LastName        = createPerson.LastName;
            originalPerson.CurrentCity     = createPerson.CurrentCity;
            originalPerson.CellphoneNumber = createPerson.CellphoneNumber;

            originalPerson = _peopleRepo.Update(originalPerson);

            return(originalPerson);
        }
Example #12
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);
        }
        public People Edit(int id, CreatePersonViewModel people)
        {
            People editedPeople = new People(id, people.Name, people.PhoneNum, people.City);

            return(_peopleRepo.Update(editedPeople));
        }