コード例 #1
0
ファイル: ThemeController.cs プロジェクト: EdiWang/Moonglade
        public async Task <IActionResult> Delete([Range(1, int.MaxValue)] int id)
        {
            var oc = await _themeService.Delete(id);

            return(oc switch
            {
                OperationCode.ObjectNotFound => NotFound(),
                OperationCode.Canceled => BadRequest("Can not delete system theme"),
                _ => NoContent()
            });
コード例 #2
0
        public IActionResult Delete(int id)
        {
            ThemeVM theme = _themeService.GetById(id);

            if (theme == null)
            {
                return(NotFound());
            }

            _themeService.Delete(theme.ThemeId);

            return(Ok(theme));
        }
コード例 #3
0
        public async Task <ActionResult> Delete(int id)
        {
            if ((await themeService.ExistsTheme(id)) == false)
            {
                return(NotFound());
            }

            try
            {
                await themeService.Delete(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #4
0
ファイル: ThemeManagement.cs プロジェクト: coderhardly/BBS
        /// <summary>
        /// 根据编号删除主题
        /// </summary>
        /// <param name="themeId"></param>
        /// <returns></returns>
        public static string Delete(string themeId)
        {
            Theme theme = new Theme()
            {
                ThemeId = themeId
            };

            if (theme.IsError)
            {
                return(theme.GetErrorMsg());
            }
            if (ITS.Delete(themeId) > 0)
            {
                return("删除成功");
            }
            else
            {
                return("删除失败");
            }
        }
コード例 #5
0
        public ActionResult Delete(int themeId)
        {
            _themeService.Delete(themeId);

            return(RedirectToAction(nameof(Index)));
        }
コード例 #6
0
 public IActionResult Delete(string themeName)
 {
     _themeService.Delete(themeName);
     return(NoContent());
 }
コード例 #7
0
        public IActionResult Remove(int id)
        {
            var res = ThemeService.Delete(id, GetUser());

            return(Redirect(res));
        }
コード例 #8
0
 public async Task <ActionResponse <ThemeDto> > Delete([FromBody] SimpleRequestBase request)
 {
     return(await themeService.Delete(request.Id));
 }