/// <summary>
        /// The seed.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Seed(QTecDataContext context)
        {
            AddDesignations(context);
            AddEmployees(context);
            context.SaveChanges();

            base.Seed(context);
        }
Exemple #2
0
        /// <summary>
        /// The add employees.
        /// </summary>
        /// <param name="dataContext">
        /// The data context.
        /// </param>
        private static void AddEmployees(QTecDataContext dataContext)
        {
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 1,
                DesignationId = 1,
                Email         = "*****@*****.**",
                FirstName     = "Shahrukh",
                LastName      = "Khan",
                Gender        = Gender.Female,
                DateOfBirth   = new DateTime(1976, 11, 1),
                Salary        = 12484
            });
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 2,
                DesignationId = 2,
                Email         = "*****@*****.**",
                FirstName     = "Salman",
                LastName      = "Khan",
                Gender        = Gender.Male,
                DateOfBirth   = new DateTime(1986, 11, 21),
                Salary        = 48473
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 3,
                DesignationId = 4,
                Email         = "*****@*****.**",
                FirstName     = "Aamir",
                LastName      = "Khan",
                Gender        = Gender.Male,
                DateOfBirth   = new DateTime(1977, 10, 8),
                Salary        = 36252
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 4,
                DesignationId = 3,
                Email         = "*****@*****.**",
                FirstName     = "Saif Ali",
                LastName      = "Khan",
                Gender        = Gender.Male,
                DateOfBirth   = new DateTime(1973, 1, 1),
                Salary        = 37262
            });
        }
 /// <summary>
 /// The add designations.
 /// </summary>
 /// <param name="dataContext">
 /// The data context.
 /// </param>
 private static void AddDesignations(QTecDataContext dataContext)
 {
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 1, Name = "Software Engineer"
     });
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 2, Name = "Sr. Software Engineer"
     });
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 3, Name = "Software Trainee"
     });
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 4, Name = "Team Lead"
     });
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 5, Name = "Tech Lead"
     });
     dataContext.Designations.AddOrUpdate(new Designation {
         Id = 6, Name = "QA Engineer"
     });
 }
        /// <summary>
        /// The add employees.
        /// </summary>
        /// <param name="dataContext">
        /// The data context.
        /// </param>
        private static void AddEmployees(QTecDataContext dataContext)
        {
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 1,
                DesignationId = 1,
                Email         = "*****@*****.**",
                FirstName     = "Shahrukh",
                LastName      = "Khan",
                Gender        = "male",
                DateOfBirth   = new DateTime(1976, 11, 1),
                Salary        = 12484
            });
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 2,
                DesignationId = 2,
                Email         = "*****@*****.**",
                FirstName     = "Salman",
                LastName      = "Khan",
                Gender        = "male",
                DateOfBirth   = new DateTime(1986, 11, 21),
                Salary        = 48473
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 3,
                DesignationId = 4,
                Email         = "*****@*****.**",
                FirstName     = "Aamir",
                LastName      = "Khan",
                Gender        = "male",
                DateOfBirth   = new DateTime(1977, 10, 8),
                Salary        = 36252
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 4,
                DesignationId = 3,
                Email         = "*****@*****.**",
                FirstName     = "Saif Ali",
                LastName      = "Khan",
                Gender        = "male",
                DateOfBirth   = new DateTime(1973, 1, 1),
                Salary        = 37262
            });
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 5,
                DesignationId = 6,
                Email         = "*****@*****.**",
                FirstName     = "Amitabh",
                LastName      = "Bachhan",
                Gender        = "male",
                DateOfBirth   = new DateTime(1967, 12, 21),
                Salary        = 47887
            });
            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 6,
                DesignationId = 5,
                Email         = "*****@*****.**",
                FirstName     = "Anil",
                LastName      = "Kapoor",
                Gender        = "male",
                DateOfBirth   = new DateTime(1978, 11, 11),
                Salary        = 23837
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 7,
                DesignationId = 3,
                Email         = "*****@*****.**",
                FirstName     = "Deepika",
                LastName      = "Padukone",
                Gender        = "female",
                DateOfBirth   = new DateTime(1986, 7, 9),
                Salary        = 12484
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 8,
                DesignationId = 4,
                Email         = "*****@*****.**",
                FirstName     = "Priyanka",
                LastName      = "Chopra",
                Gender        = "female",
                DateOfBirth   = new DateTime(1996, 3, 21),
                Salary        = 83737
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 9,
                DesignationId = 6,
                Email         = "*****@*****.**",
                FirstName     = "Shilpa",
                LastName      = "Shetty",
                Gender        = "female",
                DateOfBirth   = new DateTime(1975, 2, 21),
                Salary        = 52484
            });

            dataContext.Employees.AddOrUpdate(
                new Employee
            {
                EmployeeId    = 10,
                DesignationId = 4,
                Email         = "*****@*****.**",
                FirstName     = "Johh",
                LastName      = "Abraham",
                Gender        = "male",
                DateOfBirth   = new DateTime(1976, 12, 31),
                Salary        = 45642
            });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmployeeRepository"/> class.
 /// </summary>
 /// <param name="dataContext">
 /// The data context.
 /// </param>
 public EmployeeRepository(QTecDataContext dataContext)
 {
     this.dataContext = dataContext;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DesignationRepository"/> class.
 /// </summary>
 /// <param name="dataContext">
 /// The data context.
 /// </param>
 public DesignationRepository(QTecDataContext dataContext)
 {
     this.dataContext = dataContext;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DesignationRepository"/> class.
 /// </summary>
 /// <param name="dataContext">
 /// The data context.
 /// </param>
 public DesignationRepository(QTecDataContext dataContext)
 {
     this.dataContext = dataContext;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmployeeRepository"/> class.
 /// </summary>
 /// <param name="dataContext">
 /// The data context.
 /// </param>
 public EmployeeRepository(QTecDataContext dataContext)
 {
     this.dataContext = dataContext;
    
 }