Ejemplo n.º 1
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.RoleID = new SelectList(db.Roles, "Id", "Name", employee.RoleID);
            return View(employee);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.RoleID = new SelectList(db.Roles, "Id", "Name", employee.RoleID);
     return View(employee);
 }