public IActionResult OnPost() { if (ModelState.IsValid) { _db.Create(Book); return(RedirectToPage("Index")); } return(Page()); }
public ActionResult <Book> CreateBook(Book book) { if (book.Id.IsNullToString().Length != 24) { book.Id = ""; } _bookService.Create(book); return(CreatedAtRoute("GetBook", new { id = book.Id.ToString() }, book)); }
/// <summary> /// Creates a booking and saves it in the database /// </summary> /// <param name="Emp"></param> /// <param name="Cus"></param> /// <param name="ER"></param> /// <param name="BookingTime"></param> /// <param name="AmountOfPeople"></param> /// <param name="Date"></param> /// <returns> The booking just made (book) </returns> public int Create(Employee Emp, Customer Cus, EscapeRoom ER, TimeSpan BookingTime, int AmountOfPeople, DateTime Date) { Booking book = new Booking() { AmountOfPeople = AmountOfPeople, BookingTime = BookingTime, Cus = Cus, Date = Date, Emp = Emp, Er = ER }; return(BOOKS.Create(book)); }
public ActionResult <Book> Create(Book book) { _bookService.Create(book); return(CreatedAtRoute("GetBook", new { id = book.Id.ToString() }, book)); }