// GET: Tamagotchi/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var tamagotchiVM = new TamagotchiVM(_tamagotchiRepository.GetWhereId(id)); if (tamagotchiVM == null) { return(HttpNotFound()); } return(View(tamagotchiVM)); }
private void ChangeTamagotchiHotelRoom(HotelBookingVM hotelBookingVM) { if (hotelBookingVM.TamagotchisIds != null) { List <TamagotchiVM> tamagotchisVM = hotelBookingVM.TamagotchisIds.Select(ti => new TamagotchiVM(_tamagotchiRepository.GetWhereId(ti))).ToList(); foreach (var tamagotchiVM in tamagotchisVM) { tamagotchiVM.HotelBooking = null; tamagotchiVM.HotelRoomId = hotelBookingVM.HotelRoomId; _tamagotchiRepository.Edit(tamagotchiVM.ToModel()); } } }