Ejemplo n.º 1
0
        public ActionResult Edit(countrycode countrycode)
        {
            countrycodes.Update(countrycode);
            countrycodes.Commit();

            return RedirectToAction("Index");
        }
Ejemplo n.º 2
0
        public ActionResult Create(countrycode countrycode)
        {
            countrycodes.Insert(countrycode);
            countrycodes.Commit();

            return RedirectToAction("Index");
        }
Ejemplo n.º 3
0
        public ActionResult CreateCountry(countrycode countrycode)
        {
            //validation check
            var code1 = countrycodes.GetAll().Where(s => s.code.ToUpper().Contains(countrycode.code.ToUpper())).ToList();
            var name1 = countrycodes.GetAll().Where(s => s.name.ToUpper().Contains(countrycode.name.ToUpper())).ToList();

            var _country = new countrycode();
            _country.code = countrycode.code;
            _country.name = countrycode.name;
            _country.createDate = DateTime.Now;
            _country.lastUpdate = DateTime.Now;

            //code and name validation

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

            countrycodes.Insert(_country);
            countrycodes.Commit();

            return RedirectToAction("Index");
        }
Ejemplo n.º 4
0
 // GET: /Create
 public ActionResult CreateCountry()
 {
     var countrycode = new countrycode();
     return View(countrycode);
 }
Ejemplo n.º 5
0
        public ActionResult EditCountry(countrycode countrycode)
        {
            var _country = countrycodes.GetById(countrycode.code);

            _country.code = countrycode.code;
            _country.name = countrycode.name;
            _country.lastUpdate = DateTime.Now;
            countrycodes.Update(_country);
            countrycodes.Commit();

            return RedirectToAction("Index");
        }