/// <summary> /// 删 /// </summary> /// <param name="id"></param> /// <returns></returns> public ExcutedResult DeleteNoticeInfo(string id) { try { Guid guid = Guid.Empty; if (string.IsNullOrEmpty(id) || !Guid.TryParse(id, out guid)) { throw new BusinessException(BusinessResultCode.ArgumentError, "参数错误或无效"); } var notice = _noticeRepository.GetById(guid); if (notice == null) { throw new BusinessException(BusinessResultCode.DataNotExist, "数据不存在,请刷新!"); } else { _noticeRepository.Delete(notice); return(ExcutedResult.SuccessResult()); } } catch (BusinessException businessException) { return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message)); } catch (Exception ex) { return(ExcutedResult.FailedResult(SysResultCode.ServerException, "发生异常,请稍后再试或联系管理员")); } }
/// <summary> /// 删除 /// </summary> /// <param name="keyValue"></param> /// <returns></returns> public object DeleteNotice(string keyValue) { int nId = Convert.ToInt32(keyValue); if (_repository.Delete <Sys_Notice>(p => p.nID == nId) > 0) { return(new { state = true }); } return(new { state = false }); }
public string DeleteNotice(int uiid) { var item = NoticeRepository.GetById(uiid); try { NoticeRepository.Delete(item); unitOfWork.Commit(); // 删除该视频文件 var delFile = @item.Notice_Content.Split('$')[1]; File.Delete(delFile); } catch (Exception ex) { return(ex.ToString()); } return("OK"); }
public bool DeleteNotice(long id) { bool isSuccess = true; var notice = noticeRepository.GetById(id); try { noticeRepository.Delete(notice); SaveRecord(); ServiceUtil <Notice> .WriteActionLog(id, ENUMOperation.DELETE); } catch (Exception ex) { isSuccess = false; logger.Error("Error in deleting Notice", ex); } return(isSuccess); }
/// <summary> /// Function to delete a Notice /// </summary> /// <param name="id">int id of Notice</param> /// <returns></returns> public bool Delete(int id) { return(Repository.Delete(id)); }
public async Task <ActionResult> Delete(long id) { await _noticeRepository.Delete(id); return(Json(new { isSuccess = true })); }