public BioService.PersonList Update(BioService.PersonList proto) { BioService.PersonList persons = new BioService.PersonList(); foreach (BioService.Person curProto in proto.Persons) { BioService.Person updatedProto = Update(curProto); if (updatedProto != null) persons.Persons.Add(updatedProto); } return persons; }
public BioService.PersonList Select(BioService.CommandPersons command) { BioService.PersonList result = new BioService.PersonList(); DbSet<Person> persons = _persons.Select(); DbSet<Photo> photos = _photos.Select (); DbSet<Card> cards = _cards.Select() ; foreach (Person person in persons) { BioService.Person protoPerson = _convertor.GetPersonProto(person); if (protoPerson == null) continue; long personid = person.Id; //long thumbnailid = 0; //if (person.Thumbnail.HasValue) // thumbnailid = person.Thumbnail.Value; /* Photo thumbnail = photos.Where(x => x.Id == thumbnailid).FirstOrDefault(); if (thumbnail != null) protoPerson.Thumbnail = _convertor.GetPhotoProto(thumbnail); */ /* IQueryable<Photo> personPhotos = photos.Where(x => x.Id != thumbnailid && x.Person_Id == personid); foreach (Photo ph in personPhotos) { BioService.Photo currentPersonProto = _convertor.GetPhotoProto(ph); if (currentPersonProto != null) protoPerson.Photos.Add(currentPersonProto); } */ IQueryable<Card> personCards = cards.Where(x => x.Person_Id == personid); foreach (Card card in personCards) { BioService.Card currentCardProto = _convertor.GetCardProto(card); if (currentCardProto != null) protoPerson.Cards.Add(currentCardProto); } result.Persons.Add(protoPerson); } return result; }