コード例 #1
0
        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");
        }
コード例 #2
0
 // GET: /Create
 public ActionResult CreateSiteSize()
 {
     var sitesize = new sitesize();
     return View(sitesize);
 }
コード例 #3
0
        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");
        }