예제 #1
0
        public async Task <ActionResult> Delete(string id)
        {
            var survey = await surveys.FindAsync(id);

            if (survey == null)
            {
                return(HttpNotFound());
            }

            if (survey.Owner.UserName != security.UserName)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            await surveys.DeleteAsync(survey);

            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        public async Task <ActionResult <Survey> > DeleteSurvey(Guid id)
        {
            await _surveyService.DeleteAsync(id);

            return(Ok(id));
        }
예제 #3
0
        public async Task <IActionResult> DeleteSurvey(int id)
        {
            var info = await service.DeleteAsync(id);

            return(info ? Ok() : BadRequest() as IActionResult);
        }