public void UpdatePublicationDateDisconnected()
        {
            //SETUP
            ChangePubDateDto dto;
            var options = SqliteInMemory.CreateOptions <EfCoreContext>();

            using (var context = new EfCoreContext(options))
            {
                context.Database.EnsureCreated();
                context.SeedDatabaseFourBooks();

                var service = new ChangePubDateService(context);
                dto             = service.GetOriginal(4);
                dto.PublishedOn = new DateTime(2058, 1, 1);
            }
            using (var context = new EfCoreContext(options))
            {
                var service = new ChangePubDateService(context);

                //ATTEMPT
                service.UpdateBook(dto);

                //VERIFY
                var bookAgain = context.Books.Single(p => p.BookId == dto.BookId);
                bookAgain.PublishedOn.ShouldEqual(new DateTime(2058, 1, 1));
            }
        }
Esempio n. 2
0
        public IActionResult ChangePubDate(ChangePubDateDto dto)
        {
            Request.ThrowErrorIfNotLocal();

            var service = new ChangePubDateService(_context);

            service.UpdateBook(dto);
            SetupTraceInfo(); //REMOVE THIS FOR BOOK as it could be confusing
            return(View("BookUpdated", "Successfully changed publication date"));
        }
Esempio n. 3
0
        //-----------------------------------------------
        //Admin actions that are called on a sepcific book

        public IActionResult ChangePubDate(int id)
        {
            Request.ThrowErrorIfNotLocal();

            var service = new ChangePubDateService(_context);
            var dto     = service.GetOriginal(id);

            SetupTraceInfo(); //REMOVE THIS FOR BOOK as it could be confusing
            return(View(dto));
        }