public ActionResult Create(PreSetting model)
 {
     //check existed
     var q = this.preSettingService.Find(c => c.PreSettingNo == model.PreSettingNo);
     if (q != null)
     {
         ModelState.AddModelError("PreSettingNo", "Pre-Setting No. existed");
     }
     if (ModelState.IsValid)
     {
         model.CreateBy = this.LoginUser.UserName;
         model.CreateTime = DateTime.Now;
         this.preSettingService.Add(model);
         return RedirectToAction("List");
     }
     return View();
 }
 public ActionResult Edit(PreSetting model)
 {
     var oldPreSettingNo = Request.QueryString["preSettingNoEdit"].ToString();
     var q = this.preSettingService.Find(c => c.PreSettingNo == model.PreSettingNo);
     if (q != null && oldPreSettingNo != model.PreSettingNo)
     {
         ModelState.AddModelError("PreSettingNo", "Pre-Setting No. existed");
     }
     if (ModelState.IsValid)
     {
         q.PreSettingNo = model.PreSettingNo;
         q.DeductionNum = model.DeductionNum;
         q.IsActive = model.IsActive;
         q.UpdateTIme = DateTime.Now;
         q.UpdateBy = this.LoginUser.UserName;
         this.preSettingService.Update(q);
         return RedirectToAction("List");
     }
     return View();
 }
 public bool Update(PreSetting model)
 {
     return this.preSettingDal.Update(model);
 }
 public bool Add(PreSetting model) 
 {
     return this.preSettingDal.Add(model);
 }