コード例 #1
0
        public ActionResult Delete(int id)
        {
            Employee employee = db.Employees.Find(id);

            db.Employees.Remove(employee);
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "Did,DName,HOD,Gender")] Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(department));
        }