Ejemplo n.º 1
0
        // GET: Master
        public ActionResult Index()
        {
            BusinessUnitRep myRep    = new BusinessUnitRep(); //creates an instance (myRep) of the BUrep class in which its set to display all active BU's.
            var             activeBu = myRep.All();           //create variable activebu to get all items from myRep.

            return(View(activeBu));                           //this is to display items within activeBu.
        }
        private CFEDModel.CodeFirstExDb db = new CFEDModel.CodeFirstExDb();  // database db - this is where all of the information is kept.


        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()                        //This is where all the BusinessUnits are shows.
        {
            BusinessUnitRep myrep = new BusinessUnitRep(); //Accessing the data in repository which is all active Bisuness Units
            var             bu    = myrep.All();           // Variable BU is set to get All data from myrep instance of the repository. (Which is then set to when active == true)

            return(View(bu));                              // return view with the parameter of bu.
        }
Ejemplo n.º 3
0
        // GET: Staffs/Create
        /// <summary>
        /// get staff create page for the users to create new staff member
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            BusinessUnitRep myrep = new BusinessUnitRep();                                              // created an instance os BUrep class which shows all active BU,s.

            ViewBag.businessUnitId = new SelectList(myrep.All(), "businessUnitId", "businessUnitCode"); //displays in a dropdown list the business units which are still active
            return(View());                                                                             //return the view
        }
Ejemplo n.º 4
0
        // GET: Staffs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)                                                  //if ID is equal to null.
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); //reutnr with error
            }
            Staff staff = db.Staffs.Find(id);                                //find the specified Staff.

            if (staff == null)                                               // if its not hthere
            {
                return(HttpNotFound());                                      //throw error
            }
            BusinessUnitRep myrep = new BusinessUnitRep();

            ViewBag.businessUnitId = new SelectList(myrep.All(), "businessUnitId", "businessUnitCode", staff.businessUnitId);
            return(View(staff));       //oftherwise through the view.
        }