public ActionResult Login(UserDetails ud)
        {
            if (ModelState.IsValid)
            {
                EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
                UserStatus usr = ebl.GetValidUser(ud);
                bool IsAdmin = false;
                if (usr == UserStatus.AuthenticatedAdmin)
                {
                    IsAdmin = true;
                }

                else if (usr == UserStatus.Authenticateduser)
                {
                    IsAdmin = false;
                }
                else
                {
                    ModelState.AddModelError("CredentialError", "Invalid Credentials");
                    return View("Login");
                }
                FormsAuthentication.SetAuthCookie(ud.Username, false);
                Session["Admin"] = IsAdmin;
                return RedirectToAction("Index", "Employee");
            }

            else
                return View("Login");
        }
 public ActionResult SaveEmployee(CreateEmployeeViewModel cvm)
 {
     Employee emp = new Employee();
     emp.EmployeeFirstName = cvm.FirstName;
     emp.EmployeeLastName = cvm.LastName;
     emp.EmployeeSalary = Convert.ToDouble( cvm.Salary);
     if (ModelState.IsValid)
     {
         EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
         ebl.AddEmployee(emp);
         return RedirectToAction("Index");
     }
     else
     {
         CreateEmployeeViewModel cvmms = new CreateEmployeeViewModel();
         //cvmms.FooterData = new FooterViewModel();
         //cvmms.FooterData.CompanyName = "Step By Step Schools";
         //cvmms.FooterData.Year = DateTime.Now.Year.ToString(); ;
         cvmms.FirstName = cvm.FirstName;
         cvmms.LastName = cvm.LastName;
         cvmms.Salary = cvm.Salary;
         return View("CreateEmployee",cvm);
     }
 }
 public ActionResult Index()
 {
     EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
     List<EmployeeViewModel> evlist = new List<EmployeeViewModel>();
     List<Employee> employee = ebl.GetEmployees();
     EmployeeViewModelList elist = new EmployeeViewModelList();
     elist.FooterData = new FooterViewModel();
     foreach (Employee item in employee)
     {
         EmployeeViewModel evm = new EmployeeViewModel();
         evm.EmployeeName = item.EmployeeFirstName + " " + item.EmployeeLastName;
         evm.EmployeeSalary = item.EmployeeSalary.ToString("C");
         if (item.EmployeeSalary > 10000)
             evm.SalaryColor = "green";
         else
             evm.SalaryColor = "yellow";
         evlist.Add(evm);
     }
     elist.employees = evlist;
     //elist.UserName = User.Identity.Name;
     //elist.FooterData.CompanyName = "School Students";
     //elist.FooterData.Year = DateTime.Now.Year.ToString();
     return View("Index", elist);
 }