private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            string       categoryName = string.IsNullOrWhiteSpace(nameInput.Text) ? "Unnamed Category" : nameInput.Text;
            CategoryData categoryData = new CategoryData(categoryName, Brushes.LightSkyBlue.Color);
            long         categoryId   = new CategoryModel(categoryData).Save();

            categoryList.Children.Add(new CategoryOptions(CategoryModel.FindById(categoryId)));
        }
        public ActionResult DeleteLoaiSP(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CategoryModel spm = new CategoryModel();

            if (spm.FindById(id) == null)
            {
                return(HttpNotFound());
            }
            spm.DeleteLoaiSP(id);
            return(TimLoaiSP(null, null));
        }
        public ActionResult EditLoaiSP(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CategoryModel lm = new CategoryModel();
            LoaiSP        sp = lm.FindById(id);

            if (sp == null)
            {
                return(HttpNotFound());
            }
            return(View(sp));
        }
 public ActionResult MultibleDel(List <string> lstdel)
 {
     if (lstdel == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     foreach (var item in lstdel)
     {
         CategoryModel spm = new CategoryModel();
         if (spm.FindById(item) == null)
         {
             return(HttpNotFound());
         }
         spm.DeleteLoaiSP(item);
     }
     return(TimLoaiSP(null, null));
 }