コード例 #1
0
        public VideoBO Get(int Id)
        {
            using (var uow = facade.UnitOfWork)
            {
                //get and convert the video
                var video = conv.Convert(uow.VideoRepository.Get(Id));

                if (video.ProducerIds != null)
                {
                    //get all related Producers from ProducerRepository using producer
                    //convert and add the producers to the VideoBO

                    /*
                     * video.Producers = video.ProducerIds?
                     *  .Select(id => pconv
                     *  .Convert(uow.ProducerRepository.Get(Id)))
                     *  .ToList();
                     */
                    video.Producers = uow.ProducerRepository.GetAllById(video.ProducerIds)
                                      .Select(p => pconv.Convert(p))
                                      .ToList();
                }

                //return conv.Convert(uow.VideoRepository.Get(Id));
                return(video);
            }
        }
コード例 #2
0
 public ProducerBO Create(ProducerBO producerBO)
 {
     using (var uow = _facade.UnitOfWork)
     {
         var newproducer = uow.ProducerRepository.Create(_conv.Convert(producerBO));
         uow.Complete();
         return(_conv.Convert(newproducer));
     }
 }