public async Task <int> CreateStoryBoard(StoryBoardCreateDTO model) { var core = new StoryBoardCore() { Synopsis = model.Synopsis, Title = model.Title, UserID = model.UserId, CoverPortrait = model.CoverPortrait, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, CategoryId = model.CategoryId }; await _dbContext.StoryBoardCore.AddAsync(core); await _dbContext.SaveChangesAsync(); return(core.ID); }
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); }