コード例 #1
0
        public ActionResult Create(tblEmployee tblemployee)
        {
            if (ModelState.IsValid)
            {
                tblemployee.EmpID = Guid.NewGuid();
                tblemployee.CreateTime = System.DateTime.Now;
                tblemployee.LatestModifiedTime= System.DateTime.Now;
                tblemployee.InOffice = false;
                tblemployee.del = false;
                db.tblEmployees.Add(tblemployee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tblemployee);
        }
コード例 #2
0
 public ActionResult Edit(tblEmployee tblemployee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblemployee).State = EntityState.Modified;
         tblemployee.LatestModifiedTime = System.DateTime.Now;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tblemployee);
 }