public ActionResult CreateOrEdit(AuthorBook usersBooks)
        {
            List <BookModel> books = AutoMapper <IEnumerable <BBook>, List <BookModel> > .Map(bookService.GetBooks);

            List <UserModel> users = AutoMapper <IEnumerable <BUsers>, List <UserModel> > .Map(userService.GetUsers);

            if (usersBooks.DateOrder == null || usersBooks.DateOrder < DateTime.Now)
            {
                ViewBag.books = new SelectList(books, "Id", "Title", usersBooks.BooksId);
                ViewBag.users = new SelectList(users, "Id", "Name", usersBooks.UserId);
                ViewBag.error = "Дата заказа не должна быть пустой и должна быть больше текущей даты";
                return(View(usersBooks));
            }

            BUsersBook busersBooks = AutoMapper <AuthorBook, BUsersBook> .Map(usersBooks);

            if (userBookService.CheckUser(usersBooks.UserId))
            {
                userBookService.CreateOrUpdate(busersBooks);
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.error   = "Данный пользователь критический задолжник!!!!";
                ViewBag.BooksId = new SelectList(books, "Id", "Title", usersBooks.BooksId);
                ViewBag.UserId  = new SelectList(users, "Id", "Name", usersBooks.UserId);
                return(View());
            }
        }
 public void Post(AuthorBook value)
 {
     userBookService.CreateOrUpdate(AutoMapper <AuthorBook, BUsersBook> .Map(value));
 }