Example #1
0
        public async Task <IActionResult> Edit(QuestionCrudModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.RedirectToAction(nameof(Edit), new { id = model.Id }));
            }

            await this.questions.EditAsync(model.Id, model.Title, model.Content, this.GetUserId());

            return(this.RedirectToAction(nameof(AllInCategory), new { id = model.CategoryId }));
        }
Example #2
0
        public async Task <IActionResult> Delete(QuestionCrudModel model)
        {
            await this.questions.Delete(model.Id, this.GetUserId());

            return(this.RedirectToAction(nameof(AllInCategory), new { id = model.CategoryId }));
        }