Пример #1
0
        protected void ReportList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int       reportID = Convert.ToInt32(ReportList.DataKeys[e.RowIndex].Value.ToString());
            ReportBLL reportBL = new ReportBLL(connectionString);

            reportBL.DeleteReport(reportID);
            BindData();
        }
Пример #2
0
        // DELETE api/report/5
        public void Delete(decimal id)
        {
            User user = HttpContext.Current.Session["SigninedUser"] as User;

            if (user == null || !user.IsAdmin)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            string ResultMessage;
            int    ResultStatus = ReportBLL.DeleteReport(id, out ResultMessage);

            if (ResultStatus == 0)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            else if (ResultStatus == -1)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
        }