public ActionResult Edit(countrycode countrycode) { countrycodes.Update(countrycode); countrycodes.Commit(); return RedirectToAction("Index"); }
public ActionResult Create(countrycode countrycode) { countrycodes.Insert(countrycode); countrycodes.Commit(); return RedirectToAction("Index"); }
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"); }
// GET: /Create public ActionResult CreateCountry() { var countrycode = new countrycode(); return View(countrycode); }
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"); }