public async Task <IActionResult> Create(CreateCategoryInputViewModel model) { var userId = this.userManager.GetUserId(this.User); var categoryId = await this.categoriesService.CreateCategoryAsync(model.Name, userId); return(this.RedirectToAction("AssignQuizzesToCategory", new { id = categoryId })); }
public async Task <bool> Create(CreateCategoryInputViewModel model, string imageUploadResult) { if (model.Name == null || model.Description == null) { return(false); } var category = new Category { Name = model.Name, Description = model.Description, CategoryVersionPicture = imageUploadResult }; this._dbContext.Categories.Add(category); await this._dbContext.SaveChangesAsync(); return(true); }