public IActionResult Delete(int id) { RoomType roomTypeToDelete = iRoomTypeRepository.GetRoomTypeByID(id); if (roomTypeToDelete != null) { iRoomTypeRepository.DeleteRoomType(roomTypeToDelete.ID); iUnitOfWork.Save(); return(Ok(roomTypeToDelete)); } else { return(NotFound("Room Type with ID " + id.ToString() + " was not found.")); } }
public void DeleteRoomType() { try { Console.WriteLine("Print Id: "); int id = Int32.Parse(Console.ReadLine()); roomTypeService.DeleteRoomType(id); Console.WriteLine("Object successful updated"); ConsoleRoomTypePresenter.Present(roomTypeService.ReadRoomTypes()); } catch (Exception ex) { Console.WriteLine(ex.Message); DeleteRoomType(); } }
public RoomTypeViewModel DeleteRoomType(int id) { return(mapper.Map <RoomTypeViewModel>(roomTypeRepository.DeleteRoomType(id))); }