public IHttpActionResult AddNotice([FromBody] int userID, string text) { try { _noticeService.AddNotice(text, userID); return(Ok()); } catch (Exception ex) { var error = ex.Message + " " + ex.StackTrace.ToString(); _logService.AddError(error, userID); return(InternalServerError()); } }
/// <summary> /// 发布启示按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void PubNotice_Click(object sender, EventArgs e) { try { Notice notice = GetAddingNotice(); if (notice != null) { bool isOk = NoticeService.AddNotice(notice); // 添加到数据库 if (isOk) { Response.Redirect(URL_HOME); } } } catch (Exception ex) { PromptInfo.Text = ex.Message; } }