private void AddNewPhotos(IEnumerable <string> currentPhotoHashes, IEnumerable <string> existingPhotoHashes, IEnumerable <Photo> currentPhotos) { IEnumerable <string> hashesToAdd = currentPhotoHashes.Where(cp => !existingPhotoHashes.Contains(cp)); foreach (string hashToAdd in hashesToAdd) { Photo newPhoto = currentPhotos.Single(d => d.Photohash == hashToAdd); _context.Add(newPhoto); } }
private Person AddNewPersonFrom(RegisterSurveyViewModel model) { var person = new Person() { Idgender = model.Gender, Idagegroup = model.AgeGroup, Idethnicity = model.Ethnicity, Idsexuality = model.Sexuality, Idfamilyincome = model.FamilyIncome, }; _context.Add(person); return(person); }