Beispiel #1
0
        public async Task <IActionResult> Edit(string id)
        {
            RoomEditInputModel roomEditInputModel = (await roomService.GetById(id)
                                                     ).To <RoomEditInputModel>();

            if (roomEditInputModel == null)
            {
                return(Redirect("/Administration/Room/All"));
            }

            await GetAllRoomTypes();

            await GetAllDepartments();

            return(View(roomEditInputModel));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(string id, RoomEditInputModel roomEditInputModel)
        {
            if (!ModelState.IsValid)
            {
                await GetAllRoomTypes();

                await GetAllDepartments();

                return(View(roomEditInputModel));
            }

            RoomServiceModel roomServiceModel = AutoMapper.Mapper.Map <RoomServiceModel>(roomEditInputModel);

            await roomService.Edit(id, roomServiceModel);

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