Пример #1
0
        protected void dgvCategory_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                CategoryBL categoryBL = new CategoryBL();
                int        status     = categoryBL.DeleteCategory(int.Parse(dgvCategory.DataKeys[e.RowIndex].Values[0].ToString()));

                Response.Redirect("/administrator/categories.aspx");
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true);
            }
        }
Пример #2
0
        public string DeleteCategory(int Id)
        {
            string msg;

            if (categoryBl.DeleteCategory(Id) > 0)
            {
                msg = "Data Deleted Successfully";
            }
            else
            {
                msg = "Error. Could Not Delete Data";
            }

            return(msg);
        }
 /// <summary>
 /// Delete Category
 /// </summary>
 /// <param name="CategoryId"></param>
 /// <returns></returns>
 public IActionResult DeleteCategory(int CategoryId)
 {
     categoryBL.DeleteCategory(CategoryId);
     return(RedirectToAction("CategoryDetails"));
 }