[ValidateAntiForgeryToken]//[Bind(Include = "SelectedClientId,SelectedRoomId,ArriveDate")] public async Task<ActionResult> Create([Bind(Include = "SelectedClientId, SelectedRoomId, Event")] ClientsReservationModels clientReservation) { var reservation = new ReservationModels(); var events = new Event(); try { reservation.Id = Guid.NewGuid(); reservation.ClientId = clientReservation.SelectedClientId; events.Id = Guid.NewGuid(); events.ArriveDate = clientReservation.Event.ArriveDate; events.DepatureDate = clientReservation.Event.DepatureDate; events.Reservation = new ReservationModels { Id = reservation.Id, ClientId = clientReservation.SelectedClientId }; events.Room = db.RoomModels.FirstOrDefault(x => x.Id == clientReservation.SelectedRoomId); events.ReservationState = clientReservation.Event.ReservationState; events.Price = db.RoomModels.Where(x => x.Id == events.Room.Id).Select(x => x.FixedPricePerRoom).First(); events.Reservation = reservation; db.Events.Add(events); await db.SaveChangesAsync(); return RedirectToAction("Index"); } catch (Exception) { ViewBag.Id = new SelectList(db.Events, "Id", "Id", reservation.Id); return View(GetClientsReservationModels()); } }