示例#1
0
        public async Task <IActionResult> CreateBook(BookCreationModel vm)
        {
            var bookId = await _booksManager.CreateBook(vm);

            return(CreatedAtRoute("GetBook",
                                  new { id = bookId },
                                  vm));
        }
示例#2
0
        public async Task <string> CreateBook(BookCreationModel vm)
        {
            var booksEntity = _mapper.Map <Books>(vm);

            booksEntity.Status = true;
            _booksReprository.CreateBook(booksEntity);
            if (!(await _booksReprository.SaveAsync()))
            {
                _logger.LogInformation("error  log message");

                throw new Exception("Creating an book failed on save.");
            }
            return(booksEntity.Id.ToString());
        }
示例#3
0
        public ActionResult CreateBooking(BookCreationModel creationModel)
        {
            var model = new BookingDTO.Builder(Session["User"].ToString(), creationModel.Room, creationModel.Start, creationModel.End, creationModel.Priority).IsInternal(creationModel.IsInternal).Build();

            try
            {
                this.scheduleService.CreateBooking(model);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }

            this.Notify("Booking successfully created");

            return(View("~/Views/Notify/NotifyPage.cshtml", new { message = "Booking successfully created" }));
        }