Пример #1
0
        public ActionResult Edit(int id)
        {
            /*
             * var _department = this.department.GetDepartmentByID(id); // getting records by id GetEmployeeByID(ID)
             *
             * var retailers = this.retailer.GetRetailers().ToList();
             * ViewBag.Retailer_ID = new SelectList(retailers, "Retailer_ID", "Retailer_Name", _department.Retailer_ID);
             *
             * var DepartmentEdit = new Models.Department();
             * DepartmentEdit.Department_ID = id;
             * DepartmentEdit.Retailer_ID = _department.Retailer_ID;
             * DepartmentEdit.Department_Name = _department.Department_Name;
             * DepartmentEdit.Department_Code = _department.Department_Code;
             * DepartmentEdit.image_url = _department.image_url;
             * return View(DepartmentEdit);
             */

            // Using the Department DTO from the Department Repository
            DTO.DepartmentDto department = this.department.GetDepartmentByID(id);

            // Retailers dropdown
            var retailers = this.retailer.GetRetailers().ToList();

            ViewBag.Retailer_ID = new SelectList(retailers, "Retailer_ID", "Retailer_Name", department.Retailer_ID);

            return(View(department));
        }
Пример #2
0
        // GET: Departments/Delete/5
        public ActionResult Delete(int id)
        {
            // Before AutoMapper
            //Models.Department department = this.department.GetDepartmentByID(id);

            DTO.DepartmentDto department = this.department.GetDepartmentByID(id);
            return(View(department));
        }