Esempio n. 1
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         _db.Create(Book);
         return(RedirectToPage("Index"));
     }
     return(Page());
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        /// <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));
        }