public async Task <IActionResult> Delete(string id) { if (!CurrentUser.Stories.Any(r => r.Id == id)) { if (!User.IsInRole("Administrator")) { logger.LogInformation( string.Format(SetLog.NotTheAuthor, CurrentUser.UserName, CurrentController, id )); AddDangerNotification(string.Format(Notifications.DeleteFail)); return(Redirect($"/Stories/Details/{id}")); } } try { var result = await storyService.DeleteAsync(id); if (!result) { AddDangerNotification(Notifications.Fail); return(Redirect("/Stories")); } logger.LogInformation( string.Format(SetLog.Delete, CurrentUser.UserName, CurrentController, id )); AddSuccessNotification(Notifications.Delete); return(Redirect($"/Stories")); } catch (System.Exception e) { logger.LogError(string.Format(SetLog.Error, CurrentUser.UserName, CurrentController, e.Message)); AddDangerNotification(Notifications.Fail); return(Redirect($"/Stories")); } }