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; }
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); }
public StoryContentViewModel GetStoryScrollContent(BaseInputModel inputModel) { if (!inputModel.Id.HasValue) inputModel.Id = 0; var story = _storyService.GetStoryByID((int)inputModel.Id); return new StoryContentViewModel(story); }
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); }
public StoryListViewModel GetNewStories(BaseInputModel inputModel) { if (!inputModel.Count.HasValue) inputModel.Count = 10; var stories = _storyService.GetTopStories((int)inputModel.Count); return new StoryListViewModel(stories, CurrentUser); }
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; }