public ActionResult Province3Create(provincecode provincecode)
        {
            provincecodes.Insert(provincecode);
            provincecodes.Commit();

            return(RedirectToAction("ProvinceIndex"));
        }
        // GET: /Create with ViewBag for Dropdown
        public ActionResult Province2Create()
        {
            //Viewbag for Dropdownlist
            var country = countrycodes.GetAll();

            ViewBag.Country = country.OrderBy(q => q.name);

            var provincecode = new provincecode();

            return(View(provincecode));
        }
        public ActionResult CreateProvince(province_view province_form_page)
        {
            var _province = new provincecode();

            _province.code        = province_form_page.provinceCode;
            _province.name        = province_form_page.provinceName;
            _province.countryCode = province_form_page.countryCode;
            _province.createDate  = DateTime.Now;
            _province.lastUpdate  = DateTime.Now;
            provincecodes.Insert(_province);
            provincecodes.Commit();

            return(RedirectToAction("Index"));
        }
示例#4
0
        public ActionResult CreateProvince(province_view province_form_page)
        {
            //validation check
            var code1 = provincecodes.GetAll().Where(s => s.code.ToUpper().Contains(province_form_page.provinceCode.ToUpper())).ToList();
            var name1 = provincecodes.GetAll().Where(s => s.name.ToUpper().Contains(province_form_page.provinceName.ToUpper())).ToList();

            var _province = new provincecode();

            _province.code        = province_form_page.provinceCode;
            _province.name        = province_form_page.provinceName;
            _province.countryCode = province_form_page.countryCode;
            _province.createDate  = DateTime.Now;
            _province.lastUpdate  = DateTime.Now;

            //code and name validation

            if (_province.code == null)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_province.code.Trim().Length > 2)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (code1.Count() > 0)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_province.name == null)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_province.name.Trim().Length > 50)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (name1.Count() > 0)
            {
                return(RedirectToAction("ErrorMessage"));
            }

            provincecodes.Insert(_province);
            provincecodes.Commit();

            return(RedirectToAction("Index"));
        }
        // GET: /Create with jQuery for Dropbdown
        public ActionResult Province3Create()
        {
            var provincecode = new provincecode();

            return(View(provincecode));
        }