Ejemplo n.º 1
0
        public async Task <int> CreateStoryBoard(string userId, string title, int categoryId, string synopsis = "", string coverPortrait = null)
        {
            var categories = await _classificationStore.GetCategories();

            var category = categories.SingleOrDefault(x => x.CategoryId == categoryId);

            if (category == null)
            {
                throw new ApplicationException("Invalid category.");
            }

            var createDto = new StoryBoardCreateDTO()
            {
                UserId        = userId,
                Synopsis      = synopsis,
                Title         = title,
                CategoryId    = categoryId,
                CoverPortrait = string.IsNullOrWhiteSpace(coverPortrait) ? null : Convert.FromBase64String(coverPortrait.Split(',')[1])
            };

            var storyboardId = await _storyboardStore.CreateStoryBoard(createDto);

            return(storyboardId);
        }
 public async Task <ActionResult <List <CategoryDTO> > > GetCategories()
 {
     return(await _classificationStore.GetCategories());
 }