/*        public void Add(string newDepName, int id)
         *      {
         *          var newDepartment = new department();
         *
         *          newDepartment.DepName = newDepName;
         *          newDepartment.Manager = id;
         *
         *          db.departments.Add(newDepartment);
         *          db.SaveChanges();
         *      }*/
        public void Add(department newDep)
        {
            var newDepartment = new department();

            newDepartment.DepName = newDep.DepName;
            newDepartment.Manager = newDep.Manager;

            db.departments.Add(newDepartment);
            db.SaveChanges();
        }
        //oPTION2 - with department model
        public void Update(department department)
        {
            var existing = db.departments.FirstOrDefault(dep => dep.ID == department.ID);

            if (existing != null)
            {
                existing.DepName = department.DepName;
                existing.Manager = department.Manager;
                db.SaveChanges();
            }
        }