コード例 #1
0
        public async Task <IActionResult> Edit(string id)
        {
            DepartmentEditInputModel departmentEditInputModel = (await departmentService.GetById(id)
                                                                 ).To <DepartmentEditInputModel>();

            if (departmentEditInputModel == null)
            {
                return(Redirect("/Administration/Department/All"));
            }

            await GetAllHospitals();

            return(View(departmentEditInputModel));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, DepartmentEditInputModel departmentEditInputModel)
        {
            if (!ModelState.IsValid)
            {
                await GetAllHospitals();

                return(View(departmentEditInputModel));
            }

            DepartmentServiceModel departmentServiceModel = AutoMapper.Mapper.Map <DepartmentServiceModel>(departmentEditInputModel);

            await departmentService.Edit(id, departmentServiceModel);

            return(Redirect("/Administration/Department/All"));
        }