public ActionResult Create(ChangeReason model)
 {
     //check existed
     var q = this.changeResonService.Find(c => c.ReasonCode == model.ReasonCode);
     if (q != null)
     {
         ModelState.AddModelError("ReasonCode", "Reason code existed");
     }
     if (ModelState.IsValid)
     {
         model.CreateBy = this.LoginUser.UserName;
         model.CreateTime= DateTime.Now;
         this.changeResonService.Add(model);
         return RedirectToAction("List");
     }
     return View();
 }
 public ActionResult Edit(ChangeReason model)
 {
     var oldReasonCode = Request.QueryString["reasonCodeEdit"].ToString();
     var q = this.srService.Find(c => c.ReasonCode == model.ReasonCode);
     if (q != null && oldReasonCode != model.ReasonCode)
     {
         ModelState.AddModelError("ReasonCode", "Reason code existed");
     }
     if (ModelState.IsValid)
     {
         q.ReasonCode = model.ReasonCode;
         q.ReasonName = model.ReasonName;
         q.IsActive = model.IsActive;
         q.UpdateTime = DateTime.Now;
         q.UpdateBy = this.LoginUser.UserName;
         this.srService.Update(q);
         return RedirectToAction("List");
     }
     return View();
 }
 public bool Update(ChangeReason model)
 {
     return this.changeReasonDal.Update(model);
 }
 public bool Add(ChangeReason model)
 {
     return this.changeReasonDal.Add(model);
 }