public IActionResult AddPersonal()
        {
            List <SelectListItem> departmantItems = new List <SelectListItem>();
            var departmants = _departmantService.GetAll();

            List <SelectListItem> managerItems = new List <SelectListItem>();
            var managers = _managerService.GetAll();

            foreach (var departmant in departmants)
            {
                departmantItems.Add(new SelectListItem {
                    Text = departmant.Name, Value = departmant.Id.ToString()
                });
            }

            foreach (var manager in managers)
            {
                managerItems.Add(new SelectListItem {
                    Text = manager.Name + " " + manager.Surname, Value = manager.Id.ToString()
                });
            }

            PersonalAddView personalAddView = new PersonalAddView
            {
                Departmant = departmantItems,
                Manager    = managerItems
            };

            return(View(personalAddView));
        }
        public IActionResult Index()
        {
            var departmants    = _departmantService.GetAll();
            var departmantView = new DepartmentView
            {
                Departmants = departmants
            };

            return(View(departmantView));
        }
Esempio n. 3
0
        private void LoadTitles()
        {
            cbxTitleName.DataSource    = _titleManager.GetAll();
            cbxTitleName.DisplayMember = "Name";
            cbxTitleName.ValueMember   = "Code";

            cbxTitleNameUpdate.DataSource    = _titleManager.GetAll();
            cbxTitleNameUpdate.DisplayMember = "Name";
            cbxTitleNameUpdate.ValueMember   = "Code";

            cbxDepartmantNameQuery.DataSource    = _departmantsManager.GetAll();
            cbxDepartmantNameQuery.DisplayMember = "Name";
            cbxDepartmantNameQuery.ValueMember   = "Code";

            //foreach (var title in titleList)
            //    {
            //    using (ComboBoxItem comboBoxItem = new ComboBoxItem())
            //    {
            //        comboBoxItem.Text = title.Name;
            //        comboBoxItem.Value = title.Code;
            //        cbxTitleName.Items.Add(comboBoxItem);
            //    }
            //}
        }
Esempio n. 4
0
        public List <SelectListItem> GetDepartmantItems(Personal personal, IDepartmantService departmantService)
        {
            var departmantItems = new List <SelectListItem>();
            var departmants     = departmantService.GetAll();

            foreach (var departmant in departmants)
            {
                departmantItems.Add(departmant.Id == personal.DepartmantId
                    ? new SelectListItem {
                    Text = departmant.Name, Value = departmant.Id.ToString(), Selected = true
                }
                    : new SelectListItem {
                    Text = departmant.Name, Value = departmant.Id.ToString()
                });
            }

            return(departmantItems);
        }