public ActionResult CreateSiteSize(sitesize sitesize) { //validation check var name1 = sitesizes.GetAll().Where(s => s.description.ToUpper().Contains(sitesize.description.ToUpper())).ToList(); var _sitesize = new sitesize(); _sitesize.description = sitesize.description; _sitesize.createDate = DateTime.Now; _sitesize.lastUpdate = DateTime.Now; //code and name validation if (_sitesize.description == null) { return RedirectToAction("ErrorMessage"); } else if (_sitesize.description.Trim().Length > 20) { return RedirectToAction("ErrorMessage"); } else if (name1.Count() > 0) { return RedirectToAction("ErrorMessage"); } sitesizes.Insert(_sitesize); sitesizes.Commit(); return RedirectToAction("Index"); }
// GET: /Create public ActionResult CreateSiteSize() { var sitesize = new sitesize(); return View(sitesize); }
public ActionResult EditSiteSize(sitesize sitesize) { var _sitesize = sitesizes.GetById(sitesize.ID); _sitesize.description = sitesize.description; _sitesize.lastUpdate = DateTime.Now; sitesizes.Update(_sitesize); sitesizes.Commit(); return RedirectToAction("Index"); }