コード例 #1
0
        public ActionResult Delete(int id)
        {
            try
            {
                Category category1 = category.GetCategoryWithAttributes(id);

                if (category1 == null)
                {
                    return(NotFound("The Category is not found"));
                }
                category1.CategoryAttributes.Clear();
                category.Delete(category1);
                category.SaveAll();
                return(Ok("The Category has been Deleted"));
            }
            catch
            {
                return(BadRequest("An Error Has Occurred."));
            }
        }