public void CreateBooking(BookingsCreateVM booking) { var bookingToAdd = new Booking { RoomId = booking.RoomId, UserId = booking.UserId, StartDate = booking.StartDate, EndDate = booking.EndDate, //Statuscode = booking.Statuscode }; Booking.Add(bookingToAdd); SaveChanges(); }
public IActionResult Create(BookingsCreateVM booking) { booking.UserId = context.GetUserIdFromAspNetUserId(userManager.GetUserId(HttpContext.User)); context.CreateBooking(booking); return(View(booking)); }