Esempio n. 1
0
        public async Task <IActionResult> EditDivision(int id)
        {
            DivisionWithSupervisor div = await _webApiCalls.GetDivisionAsync(id);

            ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown();

            return(View(div));
        }
Esempio n. 2
0
        public async Task <IActionResult> AddDivision()
        {
            DivisionWithSupervisor division = new DivisionWithSupervisor();

            ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown();

            return(View(division));
        }
Esempio n. 3
0
        public async Task <IActionResult> AddDivision(DivisionWithSupervisor division)
        {
            if (!ModelState.IsValid)
            {
                return(View(division));
            }
            var dv = new Division()
            {
                DivisionName = division.DivisionName,
                SupervisorId = division.SupervisorId,
            };

            var result = await _webApiCalls.CreateAsync(dv);

            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        public async Task <IActionResult> EditDivision(int id, DivisionWithSupervisor div)
        {
            if (!ModelState.IsValid)
            {
                return(View(div));
            }

            var division = new Division()
            {
                Id           = div.Id,
                Active       = div.Active,
                DivisionName = div.DivisionName,
                SupervisorId = div.SupervisorId,
                TimeStamp    = div.TimeStamp
            };

            var result = await _webApiCalls.UpdateAsync(div.Id, division);

            return(RedirectToAction("Index"));
        }