Ejemplo n.º 1
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         EmployeeDAL.UpdateEmployee(employee);
         return RedirectToAction("Index");
     }
     return View(employee);
 }
Ejemplo n.º 2
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.UserId = WebSecurity.CurrentUserId;
                EmployeeDAL.AddEmployee(employee);
                return RedirectToAction("Index");
            }

            return View(employee);
        }
Ejemplo n.º 3
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.UserId = WebSecurity.CurrentUserId;
                db.Employees.Add(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(employee);
        }
Ejemplo n.º 4
0
 public static void UpdateEmployee(Employee employee)
 {
     db.Entry(employee).State = EntityState.Modified;
     db.SaveChanges();
 }
Ejemplo n.º 5
0
 public static void AddEmployee(Employee employee)
 {
     db.Employees.Add(employee);
     db.SaveChanges();
 }
Ejemplo n.º 6
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.UserId = new SelectList(db.UserProfiles, "UserId", "UserName", employee.UserId);
     return View(employee);
 }