コード例 #1
0
 public ActionResult Delete(int id, staff memberpost)
 {
     try
     {
         using (var db = new SDES_DirectoryEntities())
         {
             var member = db.staffs.Find(id);
             db.Entry(member).State = EntityState.Deleted;
             db.SaveChanges();
             return RedirectToAction("Details", "office", new { id = member.officeId });
         }
     }
     catch
     {
         return View();
     }
 }
コード例 #2
0
        public ActionResult Edit(int id, staff member)
        {
            try
            {
                using (var db = new SDES_DirectoryEntities())
                {
                    db.Entry(member).State = EntityState.Modified;
                    db.SaveChanges();
                }

                return RedirectToAction("Details", "office", new { id = member.officeId });
            }
            catch
            {
                return View();
            }
        }
コード例 #3
0
        public ActionResult Create(staff member)
        {
            try
            {
                using (var db = new SDES_DirectoryEntities())
                {
                    db.staffs.Add(member);
                    db.SaveChanges();
                }

                return RedirectToAction("Details", "office", new { id = member.officeId });
            }
            catch
            {
                return View();
            }
        }