Example #1
0
 public List <Employee> GetEmployees()
 {
     try
     {
         WebMainDBContext webMainDBContext = new WebMainDBContext();
         var listofEmployees = webMainDBContext.Employees.ToList();
         return(listofEmployees);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Example #2
0
        public List <Department> GetDepartments()
        {
            try
            {
                WebMainDBContext webMainDBContext = new WebMainDBContext();
                var listofDepartments             = webMainDBContext.Departments.ToList();
                #region To add dummy data should be deleted in future...
                //List<Department> listofDepartments = new List<Department>();
                //listofDepartments.Add(new Department { Id = 011, Location = "New York", Name = "HR" });
                //listofDepartments.Add(new Department { Id = 012, Location = "Sydney", Name = "Payroll" });
                //listofDepartments.Add(new Department { Id = 013, Location = "Chicago", Name = "IT" });
                #endregion

                return(listofDepartments);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }