Example #1
0
        public ActionResult Edit(int id)
        {
            PublishingDTO publishing = publishingService.GetPublishing(id);

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

            PublishingEditViewModel editViewModel = new PublishingEditViewModel
            {
                Publishing = mapper.Map <PublishingViewModel>(publishing),

                AvailableTopics = mapper
                                  .Map <IEnumerable <TopicViewModel> >(publishingService.GetTopicsNotInPublishing(id)),

                TopicsAtPublishing = mapper
                                     .Map <IEnumerable <TopicViewModel> >(publishing.Topics),

                EditorsAtPublishing = mapper
                                      .Map <IEnumerable <PublishingEmployeeViewModel> >(publishing.Editors),

                JournalistsAtPublishing = mapper
                                          .Map <IEnumerable <PublishingEmployeeViewModel> >(publishing.Journalists),

                AvailableEditors = mapper
                                   .Map <IEnumerable <PublishingEmployeeViewModel> >(publishingService.GetEditorsNotInPublishing(id)),

                AvailableJournalists = mapper
                                       .Map <IEnumerable <PublishingEmployeeViewModel> >(publishingService.GetJournalistsNotInPublishing(id)),
            };

            return(View(editViewModel));
        }