public ActionResult Delete(int id = 0)
        {
            //check
            if (!this._nhanvien_permission.Contains("kichthuoc_delete"))
            {
                return this._fail_permission("kichthuoc_delete");
            }

            KichThuocController controller = new KichThuocController();
            if (!controller.is_exist(id))
            {
                return RedirectToAction("Index", "AdminKichThuocs");
            }
            try
            {
                controller.delete(id);
            }
            catch (Exception)
            {
                return _show_notification("Kích thước này có dính khóa ngoại với sản phẩm hiện có nên không xóa được");
            }
            return RedirectToAction("Index", "AdminKichThuocs");
        }
        public ActionResult Submit()
        {
            //get nv id first
            int obj_id = TextLibrary.ToInt(Request["kichthuoc_id"]);
            KichThuocController ctr = new KichThuocController();
            KichThuoc obj;
            //check mode
            Boolean edit_mode = true;
            if (obj_id == 0)
            {
                //add mode
                if (!this._nhanvien_permission.Contains("kichthuoc_add"))
                {
                    return _fail_permission("kichthuoc_add");
                }

                obj = new KichThuoc();
                edit_mode = false;
            }
            else
            {
                //edit mode
                if (!this._nhanvien_permission.Contains("kichthuoc_edit"))
                {
                    return _fail_permission("kichthuoc_edit");
                }

                if (ctr.is_exist(obj_id))
                {
                    //update model
                    //get instance of record of table
                    obj = ctr.get_by_id(obj_id);
                }
                else
                {
                    //nvid khong ton tai
                    return RedirectToAction("Index", "AdminKichThuocs");
                }
            }
            //assign value
            obj.giatri = TextLibrary.ToString(Request["kichthuoc_giatri"]);
            obj.mota = TextLibrary.ToString(Request["kichthuoc_mota"]);
            obj.active = TextLibrary.ToBoolean(Request["kichthuoc_active"]);
            //validate properties
            List<String> validate = ctr.validate(obj);

            //action
            if (validate.Count == 0)
            {
                if (edit_mode)
                {
                    //update properties first
                    ctr._db.SaveChanges();
                    this._state.Add("edit_ok");
                }
                else
                {
                    //call add
                    int maxid = ctr.add(obj);
                    //re assign id
                    obj.id = maxid;
                    this._state.Add("add_ok");
                }
                //successfull redirect
                return RedirectToAction("Index", "AdminKichThuocs");
            }
            //fail redirect
            this._state.AddRange(validate);
            ViewBag.State = this._state;
            ViewBag.KichThuoc = obj;
            ViewBag.Title += " - Submit";
            return View("Index");
        }