//----------------------------------------------
        //Now the code to alter the book

        public IActionResult ChangePubDate(int id, [FromServices] IChangePubDateService service)
        {
            var dto = service.GetOriginal(id);

            SetupTraceInfo();
            return(View(dto));
        }
 public IActionResult ChangePubDate(ChangePubDateDto dto,
                                    [FromServices] IChangePubDateService service)
 {
     Request.ThrowErrorIfNotLocal();
     service.UpdateBook(dto);
     SetupTraceInfo(); //REMOVE THIS FOR BOOK as it could be confusing
     return(View("BookUpdated", "Successfully changed publication date"));
 }
Exemplo n.º 3
0
        public IActionResult ChangePubDate(ChangePubDateDto changePubDate, [FromServices] IChangePubDateService service)
        {
            Request.ThrowErrorIfNotLocal();
            var updatedBook = service.UpdateBook(changePubDate);

            SetupTraceInfo();

            return(View("BookUpdated", "Successfully changed publication date"));
        }
Exemplo n.º 4
0
        public IActionResult ChangePubDate(int bookId, [FromServices] IChangePubDateService service)
        {
            Request.ThrowErrorIfNotLocal();
            var original = service.GetOriginal(bookId);

            SetupTraceInfo();

            return(View(original));
        }
        public IActionResult ChangePubDate                //#A
            (int id,                                      //#B
            [FromServices] IChangePubDateService service) //#C
        {
            Request.ThrowErrorIfNotLocal();               //REMOVE THIS FOR BOOK as it isn't relevant
            var dto = service.GetOriginal(id);            //#D

            SetupTraceInfo();                             //REMOVE THIS FOR BOOK as it could be confusing
            return(View(dto));                            //#E
        }
        public IActionResult ChangePubDate(ChangePubDateDto dto, [FromServices] IChangePubDateService service)
        {
            if (!ModelState.IsValid)
            {
                return(View(dto));
            }

            service.UpdateBook(dto);
            SetupTraceInfo();
            return(View("BookUpdated", "Successfully changed publication date"));
        }