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

            return(View(viewModel));
        }
Exemplo n.º 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());
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
 public void OnGet()
 {
     Departments = _departmentData.GetDepartments(Department).GetAwaiter().GetResult();
 }
 public IActionResult GetDepartments()
 {
     return(Ok(_departmentData.GetDepartments()));
 }