public ActionResult CreateReasonForPayment(reasonforpayment reasonforpayment)
        {
            //validation check
            var name1 = reasonforpayments.GetAll().Where(s => s.description.ToUpper().Contains(reasonforpayment.description.ToUpper())).ToList();

            var _reasonforpayment = new reasonforpayment();
            _reasonforpayment.ID = reasonforpayment.ID;
            _reasonforpayment.description = reasonforpayment.description;
            _reasonforpayment.createDate = DateTime.Now;
            _reasonforpayment.lastUpdate = DateTime.Now;

            //code and name validation

            if (_reasonforpayment.description == null)
            {
                return RedirectToAction("ErrorMessage");
            }
            else if (_reasonforpayment.description.Trim().Length > 45)
            {
                return RedirectToAction("ErrorMessage");
            }
            else if (name1.Count() > 0)
            {
                return RedirectToAction("ErrorMessage");
            }

            reasonforpayments.Insert(_reasonforpayment);
            reasonforpayments.Commit();

            return RedirectToAction("Index");
        }
        public ActionResult CreateReasonForPayment(reasonforpayment reasonforpayment)
        {
            var _reasonforpayment = new reasonforpayment();
            _reasonforpayment.ID = reasonforpayment.ID;
            _reasonforpayment.description = reasonforpayment.description;
            _reasonforpayment.createDate = DateTime.Now;
            _reasonforpayment.lastUpdate = DateTime.Now;
            reasonforpayments.Insert(_reasonforpayment);
            reasonforpayments.Commit();

            return RedirectToAction("Index");
        }
 private void updateReasonForPayment()
 {
     foreach (reasonForPayment.E e in Enum.GetValues(typeof(reasonForPayment.E)))
     {
         var r = reasonsforpayment.GetByKey("ID", (long)e);
         if (r == null)
         {
             reasonforpayment new_r = new reasonforpayment();
             new_r.ID = (long)e;
             new_r.description = e.ToString();
             reasonsforpayment.Insert(new_r);
         }
         else
         {
             r.description = e.ToString();
             reasonsforpayment.Update(r);
         }
     }
     reasonsforpayment.Commit();
 }
 // GET: /Create
 public ActionResult CreateReasonForPayment()
 {
     var reasonforpayment = new reasonforpayment();
     return View(reasonforpayment);
 }
        public ActionResult EditReasonForPayment(reasonforpayment reasonforpayment)
        {
            var _reasonforpayment = reasonforpayments.GetById(reasonforpayment.ID);

            _reasonforpayment.description = reasonforpayment.description;
            _reasonforpayment.lastUpdate = DateTime.Now;
            reasonforpayments.Update(_reasonforpayment);
            reasonforpayments.Commit();

            return RedirectToAction("Index");
        }