// GET: /Create
        public ActionResult CreateProvince()
        {
            //Dropdown list for country
            var country = countrycodes.GetAll();
            ViewBag.Country = country.OrderBy(q => q.name);

            var province_view = new province_view();
            return View(province_view);
        }
        public ActionResult EditProvince(province_view province_form_page)
        {
            var _province = provincecodes.GetById(province_form_page.provinceCode);

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

            return RedirectToAction("Index");
        }
        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");
        }
        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");
        }