Ejemplo n.º 1
0
        protected virtual void PrepareDepartmentModel(DepartmentModel model, Department department) {
            if (model == null)
                throw new ArgumentNullException("model");
            var departments = _departmentService.GetAll();

            model.AvailableDepartments.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Department.NotParentDepartment"), Value = "0" });

            foreach (var d in departments)
                model.AvailableDepartments.Add(new SelectListItem {
                    Text = d.Name,
                    Value = d.Id.ToString(),
                    Selected = department == null ? false : d.Id == department.ParentId
                });
            

            var stores = _storeService.GetAllStores();
            model.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Common.Select"), Value = "0" });
            foreach (var d in stores) {
                model.AvailableStores.Add(new SelectListItem {
                    Value = d.Id.ToString(),
                    Text = d.Name,
                    Selected = department != null ? model.StoreId == d.Id : false
                });
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes a department
        /// </summary>
        /// <param name="department">Department</param>
        public virtual void Delete(Department department) {
            if (department == null)
                throw new ArgumentNullException("department");

            _departmentRepository.Delete(department);

            _signals.Trigger(DEPARTMENT_PATTERN_KEY);

        }