Exemple #1
0
        public static void Run()
        {
            List <IApplicantModel> applicants = new List <IApplicantModel>
            {
                new PersonModel()
                {
                    FirstName = "Tim", LastName = "Corey"
                },
                new ManagerModel()
                {
                    FirstName = "Nancy", LastName = "Storm"
                },
                new ExecutiveModel()
                {
                    FirstName = "Sue", LastName = "Roman"
                }
            };

            List <EmployeeModel> employees = Hirer.Hire(applicants);

            Logger.LogEmployees(employees);
        }
        public ActionResult Hirer(Hirer hirer)
        {
            if (ModelState.IsValid)
            {
                tblUser user  = new tblUser();
                Hirer   Hirer = new Hirer();
                Hirer.FirstName = hirer.FirstName;
                Hirer.LastName  = hirer.LastName;
                Hirer.Age       = hirer.Age;
                Hirer.Email     = hirer.Email;
                Hirer.Gender    = hirer.Gender;
                Hirer.Address   = hirer.Address;

                user.Username = hirer.user.Username;
                user.Password = hirer.user.Password;
                user.Type     = "Hirer";
                entity.Hirers.Add(Hirer);
                entity.tblUsers.Add(user);
                entity.SaveChanges();

                return(RedirectToAction("Login"));
            }
            return(View());
        }