Example #1
0
 public List <Employee> Search()
 {
     using (var db = new LibraryDBEntities())
     {
         try
         {
             return(db.Employees.ToList());
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Example #2
0
        public bool SaveEmployee(string fname, string lname, string tel)
        {
            bool result = false;

            try
            {
                using (var db = new LibraryDBEntities())
                {
                    var employee = new Employee()
                    {
                        FName = fname, LName = lname, Tel = tel
                    };
                    db.Employees.Add(employee);
                    db.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }