Ejemplo n.º 1
0
        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()
            });
        public IActionResult Delete(int id)
        {
            ThemeVM theme = _themeService.GetById(id);

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

            _themeService.Delete(theme.ThemeId);

            return(Ok(theme));
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 4
0
        /// <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("删除失败");
            }
        }
Ejemplo n.º 5
0
        public ActionResult Delete(int themeId)
        {
            _themeService.Delete(themeId);

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 6
0
 public IActionResult Delete(string themeName)
 {
     _themeService.Delete(themeName);
     return(NoContent());
 }
Ejemplo n.º 7
0
        public IActionResult Remove(int id)
        {
            var res = ThemeService.Delete(id, GetUser());

            return(Redirect(res));
        }
Ejemplo n.º 8
0
 public async Task <ActionResponse <ThemeDto> > Delete([FromBody] SimpleRequestBase request)
 {
     return(await themeService.Delete(request.Id));
 }