public async Task <IActionResult> Edit(int id) { RoomTypeEditInputModel roomTypeInputModel = (await roomTypeService.GetById(id) ).To <RoomTypeEditInputModel>(); if (roomTypeInputModel == null) { return(Redirect("/Administration/RoomtType/All")); } return(View(roomTypeInputModel)); }
public async Task <IActionResult> Edit(int id, RoomTypeEditInputModel roomTypeEditInputModel) { if (!ModelState.IsValid) { return(View(roomTypeEditInputModel)); } RoomTypeServiceModel roomTypeServiceModel = AutoMapper.Mapper.Map <RoomTypeServiceModel>(roomTypeEditInputModel); await roomTypeService.Edit(id, roomTypeServiceModel); return(Redirect("/Administration/RoomType/All")); }