Beispiel #1
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            ViewModels.DepartmentViewModel viewModel = new ViewModels.DepartmentViewModel();
            viewModel.Departments = (IEnumerable <Department>)_DepartmentData.GetDepartments();

            return(View(viewModel));
        }
Beispiel #2
0
        public async Task <IActionResult> OnGet(int?departmentId)
        {
            PlantsList = _plantData.GetPlants()
                         .GetAwaiter().GetResult().Select(a => new SelectListItem
            {
                Value = a.PlantId.ToString(),
                Text  = a.Name
            });

            if (departmentId.HasValue)
            {
                Department.DepartmentId = departmentId.Value;
                var dep = await _departmentData.GetDepartments(Department);

                Department = dep.FirstOrDefault();
            }
            else
            {
                Department = new DepartmentVM();
            }
            if (Department == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            return(Page());
        }
        public async Task <IActionResult> OnGet(int departmentId)
        {
            Department.DepartmentId = departmentId;
            var dep = await _departmentData.GetDepartments(Department);

            Department = dep.FirstOrDefault();

            if (Department == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            return(Page());
        }
Beispiel #4
0
 public void OnGet()
 {
     Departments = _departmentData.GetDepartments(Department).GetAwaiter().GetResult();
 }
 public IActionResult GetDepartments()
 {
     return(Ok(_departmentData.GetDepartments()));
 }