public ActionResult Create(CutterAdapterType model)
 {
     //check existed
     var q = this.catService.Find(c => c.TypeName == model.TypeName);
     if (q != null)
     {
         ModelState.AddModelError("TypeName", "TypeName existed");
     }
     if (ModelState.IsValid)
     {
         model.CreateBy = this.LoginUser.UserName;
         model.CreateTime = DateTime.Now;
         this.catService.Add(model);
         return RedirectToAction("List");
     }
     return View();
 }
 public ActionResult Edit(CutterAdapterType model)
 {
     var oldTypename = Request.QueryString["oldTypeName"].ToString();
     var qCheck = this.catService.Find(c => c.TypeName == model.TypeName);
     if (qCheck != null && oldTypename != qCheck.TypeName)
     {
         ModelState.AddModelError("TypeName", "Type name existed");
     }
     if (ModelState.IsValid)
     {
         var q = this.catService.Find(c => c.ID == model.ID);
         q.TypeName = model.TypeName;
         q.IsActive = model.IsActive;
         q.UpdateTime = DateTime.Now;
         q.UpdateBy = this.LoginUser.UserName;
         this.catService.Update(q);
         return RedirectToAction("List");
     }
     return View();
 }
 public bool Update(CutterAdapterType model)
 {
     return this.catDal.Update(model);
 }
 public bool Add(CutterAdapterType model)
 {
     return this.catDal.Add(model);
 }