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)); }
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)); } }
/// <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("删除失败"); } }
public ActionResult Delete(int themeId) { _themeService.Delete(themeId); return(RedirectToAction(nameof(Index))); }
public IActionResult Delete(string themeName) { _themeService.Delete(themeName); return(NoContent()); }
public IActionResult Remove(int id) { var res = ThemeService.Delete(id, GetUser()); return(Redirect(res)); }
public async Task <ActionResponse <ThemeDto> > Delete([FromBody] SimpleRequestBase request) { return(await themeService.Delete(request.Id)); }