Ejemplo n.º 1
0
 // **************************************
 // URL: /Employee/Add
 // **************************************
 //[Authorize]
 public ActionResult Add()
 {
     var viewModel = new EmployeeManagerViewModel
     {
         Employee = new Employee(),
         SubSegments = storeDB.Segment.Where(s => s.ParentId == 4).ToList(),
         Status = DOSB.GlobalConstant.EMPLOYEE_STATUS
     };
     return View(viewModel);
 }
Ejemplo n.º 2
0
        public ActionResult Add(Employee employee)
        {
            if (ModelState.IsValid)
            {
                // if employee already exists, use the employee in database to update data
                int count = storeDB.Employee.Count(s => s.LDAP == employee.LDAP);
                if (count == 0)
                {
                    // add LDAP information
                    if (updateLDAPInfo(employee))
                    {
                        // save to database
                        storeDB.AddToEmployee(employee);
                        storeDB.SaveChanges();
                        ViewData["message"] = employee.LDAP + " has been added!";
                    }
                    else
                    {
                        ViewData["message"] = "Alias Not Found!";
                    }
                }
                else
                {
                    ViewData["message"] = "Alias already exist in DOSB system.";
                }

                RedirectToAction("index", "Employee");
            }

            var viewModel = new EmployeeManagerViewModel
            {
                Employee = employee,
                SubSegments = storeDB.Segment.Where(s => s.ParentId == 4).ToList()
            };
            return View(viewModel);
        }
Ejemplo n.º 3
0
 //
 // GET: /Employee/
 public ActionResult Index()
 {
     var viewModel = new EmployeeManagerViewModel
     {
         AllEmployees = storeDB.Employee.Include("Segment").ToList(),
         SubSegments = storeDB.Segment.Where(s => s.ParentId == 4).ToList(),
         Status = GlobalConstant.EMPLOYEE_STATUS,
     };
     return View(viewModel);
 }