Пример #1
0
        public ActionResult CreatePayDocType(paydoctype paydoctype)
        {
            //validation check
            var name1 = paydoctypes.GetAll().Where(s => s.description.ToUpper().Contains(paydoctype.description.ToUpper())).ToList();

            var _paydoctype = new paydoctype();

            _paydoctype.ID          = paydoctype.ID;
            _paydoctype.description = paydoctype.description;
            _paydoctype.createDate  = DateTime.Now;
            _paydoctype.lastUpdate  = DateTime.Now;

            //code and name validation

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

            paydoctypes.Insert(_paydoctype);
            paydoctypes.Commit();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        // GET: /Edit/5
        public ActionResult EditPayDocType(int id)
        {
            paydoctype paydoctype = paydoctypes.GetById(id);

            if (paydoctype == null)
            {
                return(HttpNotFound());
            }
            return(View(paydoctype));
        }
Пример #3
0
        public ActionResult EditPayDocType(paydoctype paydoctype)
        {
            var _paydoctype = paydoctypes.GetById(paydoctype.ID);

            _paydoctype.description = paydoctype.description;
            _paydoctype.lastUpdate  = DateTime.Now;
            paydoctypes.Update(_paydoctype);
            paydoctypes.Commit();

            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult CreatePayDocType(paydoctype paydoctype)
        {
            var _paydoctype = new paydoctype();

            _paydoctype.ID          = paydoctype.ID;
            _paydoctype.description = paydoctype.description;
            _paydoctype.createDate  = DateTime.Now;
            _paydoctype.lastUpdate  = DateTime.Now;
            paydoctypes.Insert(_paydoctype);
            paydoctypes.Commit();

            return(RedirectToAction("Index"));
        }
Пример #5
0
        // GET: /Create
        public ActionResult CreatePayDocType()
        {
            var paydoctype = new paydoctype();

            return(View(paydoctype));
        }