Ejemplo n.º 1
0
        public ActionResult Create(Employee employee)
        {
           //Thread.Sleep(2000);
            db.Employee.Add(employee);
            db.SaveChanges();

            return Json(employee, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
 public ActionResult create( Employee em)
 {
     var depts = db.Dept.ToList();
     SelectList deptlist1 = new SelectList(depts, "ID", "DName");
     ViewBag.DeptList = deptlist1;
         if (ModelState.IsValid)
         {
             db.emp.Add(em);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     return View(em);
 }
Ejemplo n.º 3
0
        public ActionResult Edit(Employee em)
        {
            var depts = db.Dept.ToList();
            SelectList deptlist1 = new SelectList(depts, "ID", "DName");
            ViewBag.DeptList = deptlist1;

            if (ModelState.IsValid)
            {
                db.Entry(em).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(em);
        }
Ejemplo n.º 4
0
        public JsonResult Edit(Employee employee)
        {
           // Thread.Sleep(2000);
            db.Entry(employee).State = EntityState.Modified;
            db.SaveChanges();

            return Json(employee, JsonRequestBehavior.AllowGet);
        }
 public Employee Add(Employee employee)
 {
     employee.Id =_employeeList.Max(e => e.Id)+1;
     _employeeList.Add(employee);
     return employee;
 }