public void ListViewEmployees_InsertItem()
 {
     var item = new Employee();
     TryUpdateModel(item);
     if (ModelState.IsValid)
     {
         dbContext.SaveChanges();
     }
 }
示例#2
0
        public static void GivePromotion(Employee emp)
        {
            Console.WriteLine("{0} was promoted", emp.Name);

            if (emp is SalesPerson)
            {
                Console.WriteLine("{0} made {1} salaes(s)!", emp.Name, ((SalesPerson)emp).SalesNumber);
            }

            if (emp is Manager)
            {
                Console.WriteLine("{0} had {1} stock options...", emp.Name, ((Manager)emp).StockOptions);
            }
        }
示例#3
0
 public Employee CreateEmployee()
 {
     Employee E1=new Employee();
     Console.WriteLine("Employee name: ");
     E1.Name = Console.ReadLine();
     Console.WriteLine("Employee surname: ");
     E1.Surname = Console.ReadLine();
     Console.WriteLine("Employee age: ");
     E1.Age = Int32.Parse(Console.ReadLine());
     Console.WriteLine("Employee position: ");
     E1.Position = Console.ReadLine();
     Console.WriteLine("Employee salary: ");
     E1.Salary = Double.Parse(Console.ReadLine());
     return E1;
 }
示例#4
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Enkapsulation *****\n");

            Console.WriteLine("These folks work at: {0}", Employee.Company);

            Employee emp = new Employee("Marvin", 24, 456, 30000, "111-11-1111");
            emp.GiveBonus(1000);
            emp.DisplayStats();

            emp.Name = "Marv";
            Console.WriteLine("Employee is named: {0}", emp.Name);

            Console.ReadLine();
        }