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

            //ViewBag.BranchId = new SelectList(db.Branches, "Id", "BranchName", employee.BranchId);
            //ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", employee.DepartmentId);
            //ViewBag.DesignationId = new SelectList(db.Designations, "Id", "DesignationName", employee.DesignationId);
            //ViewBag.TitleId = new SelectList(db.Titles, "Id", "TitleName", employee.TitleId);
            //ViewBag.GenderId = new SelectList(db.Genders, "Id", "GenderName", employee.GenderId);
            return View(employee);
        }
Exemplo n.º 2
0
        public ActionResult Edit(Employee employee)
        {
            if (ModelState.IsValid)
            {
                Service.Update(employee);
                return RedirectToAction("Index");
            }

            return View(employee);
        }