Exemple #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var userId = await _accountManager.GetUserIdByNameAsync(User.Identity.Name);

            await _questionManager.DeleteAsync(id, userId);

            return(RedirectToAction("Index", "Question"));
        }
Exemple #2
0
        public async Task <IActionResult> DeleteQuestion(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid id!"));
            }

            try
            {
                await _questionManager.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }