Ejemplo n.º 1
0
        public int UpdateBook(int id, BookIdentification BookObject)
        {
            var Book = _appDbContext.BookIdentification.Where(c => c.BookID == id).SingleOrDefault();

            if (Book == null)
            {
                return(0); //if Fails return 0
            }
            else
            {
                Book.Status = BookObject.Status;
                _appDbContext.SaveChanges();
                return(1); //if success return 1
            }
        }
Ejemplo n.º 2
0
        public int UpdateBookIdentification(int bookID, BookIdentification bookIdentificationObject)
        {
            var bookIdentification = _appDbContext.BookIdentification.Where(c => c.BookID == bookID).SingleOrDefault();

            if (bookID == 0)
            {
                return(0);
            }
            else
            {
                bookIdentification.Status   = bookIdentificationObject.Status;
                bookIdentification.DetailID = bookIdentificationObject.DetailID;

                _appDbContext.SaveChanges();
                return(1);
            }
        }
        public IActionResult UpdateBookIdentification(int bookID, [FromBody] BookIdentification bookIdentificationObject)
        {
            if (bookID < 0)
            {
                return(BadRequest());
            }

            int update = _bookIdentificationRepo.UpdateBookIdentification(bookID, bookIdentificationObject);

            if (update == 0)
            {
                return(BadRequest());
            }
            else
            {
                return(Ok());
            }
        }
 public IActionResult CreateBookIdentification([FromBody] BookIdentification newBookIdentification)
 {
     _bookIdentificationRepo.CreateBookIdentification(newBookIdentification);
     return(Ok());
 }
Ejemplo n.º 5
0
 public void CreateBookIdentification(BookIdentification newBookIdentification)
 {
     _appDbContext.BookIdentification.Add(newBookIdentification);
     _appDbContext.SaveChanges();
 }