public async Task <IActionResult> Create(ForumCategoryEditModel model)
        {
            if (ModelState.IsValid)
            {
                var forumCategory = new ForumCategory
                {
                    Name = model.Name
                };

                this.context.ForumCategories.Add(forumCategory);
                await this.context.SaveChangesAsync();

                return(this.RedirectToAction("Index"));
            }
            return(View(model));
        }
        public async Task <IActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var forumCategory = await this.context.ForumCategories.SingleOrDefaultAsync(m => m.Id == id);

            if (forumCategory == null)
            {
                return(this.NotFound());
            }

            var model = new ForumCategoryEditModel
            {
                Name = forumCategory.Name
            };

            return(this.View(model));
        }
        public async Task <IActionResult> Edit(Guid id, ForumCategoryEditModel model)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var forumCategory = await this.context.ForumCategories.SingleOrDefaultAsync(m => m.Id == id);

            if (forumCategory == null)
            {
                return(this.NotFound());
            }

            if (this.ModelState.IsValid)
            {
                forumCategory.Name = model.Name;
                await this.context.SaveChangesAsync();

                return(this.RedirectToAction("Index"));
            }

            return(this.View(model));
        }