示例#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"));
        }
        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);
        }