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

            ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown();

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

            ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown();

            return(View(division));
        }
Exemplo 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"));
        }
Exemplo 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"));
        }