コード例 #1
0
 public BaseViewModel Buy(BaseInputModel inputModel)
 {
     if (!inputModel.Id.HasValue)
         inputModel.Id = 0;
     var story = _storyService.GetStoryByID((int)inputModel.Id);
     var result = _storyService.BuyStory(story, CurrentUser);
     var rv = new BaseViewModel
                  {
                      Success = result
                  };
     return rv;
 }
コード例 #2
0
        public StoryListViewModel GetTopStories(BaseInputModel inputModel)
        {
            if (!inputModel.Count.HasValue)
                inputModel.Count = 10;
            var stories = _storyService.GetTopStories((int) inputModel.Count);
            foreach (var storey in stories)
            {
                if (storey.CoverArt == null)
                {
                    var coverArt = new CoverArt
                                       {
                                           Cover = ResizeImage.ResizeImageFile(@"Content\img\64x64.gif",32,32)
                                       };
                    storey.CoverArt = coverArt;

                }

            }
            return new StoryListViewModel(stories, CurrentUser);
        }
コード例 #3
0
 public StoryContentViewModel GetStoryScrollContent(BaseInputModel inputModel)
 {
     if (!inputModel.Id.HasValue)
         inputModel.Id = 0;
     var story = _storyService.GetStoryByID((int)inputModel.Id);
     return new StoryContentViewModel(story);
 }
コード例 #4
0
 public PagedStoryListViewModel GetStoriesByGenre(BaseInputModel inputModel)
 {
     if (!inputModel.Page.HasValue)
         inputModel.Page = 1;
     var filter = new StoryFilter();
     if (inputModel.Id.HasValue)
     {
          filter = new StoryFilter
                          {
                              Genre = (Genre) inputModel.Id
                          };
     }
     var story = _storyService.GetStories(filter,(int)inputModel.Page,25);
     return new PagedStoryListViewModel(story, CurrentUser);
 }
コード例 #5
0
        public StoryListViewModel GetNewStories(BaseInputModel inputModel)
        {
            if (!inputModel.Count.HasValue)
                inputModel.Count = 10;
            var stories = _storyService.GetTopStories((int)inputModel.Count);

            return new StoryListViewModel(stories, CurrentUser);
        }
コード例 #6
0
 public StoryViewModel GetDetails(BaseInputModel inputModel)
 {
     if (!inputModel.Id.HasValue)
         inputModel.Id = 0;
     var story = _storyService.GetStoryByID((int)inputModel.Id);
     var vm = new StoryViewModel(story, CurrentUser);
     vm.AccountBalance = CurrentUser.AccountBalance;
     vm.StoryPrice = story.Price;
     return vm;
 }