//编辑
 public CheckContentCat Edit(CheckContentCat CheckContentCat)
 {
     DBEntity.CheckContentCat.Attach(CheckContentCat);
           DBEntity.Entry<CheckContentCat>(CheckContentCat).State = EntityState.Modified;
           DBEntity.SaveChanges();
           return CheckContentCat;
 }
 // post api/CheckContentCat
 //  [MyAuthorize(Modules = "检查模板", Operation = "新增")]
 public HttpResponseMessage Post(CheckContentCat NewCheckContentCat)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CheckContentCat item = new CheckContentCat();
             item.ParentId = NewCheckContentCat.ParentId;
             item.CategoryName = NewCheckContentCat.CategoryName;
             db.CheckContentCat.Add(item);
             //  db.CheckContentCat.Add(NewCheckContentCat);
             db.SaveChanges();
             return Request.CreateResponse(HttpStatusCode.OK);
         }
         else
         {
             return Request.CreateResponse(HttpStatusCode.NotFound);
         }
     }
     catch (Exception)
     {
         return Request.CreateResponse(HttpStatusCode.BadRequest);
     }
 }
        // PUT api/CheckContentCat/5
        //   [MyAuthorize(Modules = "检查模板", Operation = "编辑")]
        public HttpResponseMessage Put(int id, CheckContentCat NewCheckContentCat)
        {
            try
            {

                if (NewCheckContentCat == null)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }
                else
                {
                    //待编辑的字段赋值

                    ICheckContentCat.Edit(NewCheckContentCat);
                    return Request.CreateResponse(HttpStatusCode.OK);
                }
            }
            catch (Exception)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 //新增
 public CheckContentCat Add(CheckContentCat CheckContentCat)
 {
     DBEntity.CheckContentCat.Add(CheckContentCat);
                  DBEntity.SaveChanges();
              return  CheckContentCat ;
 }