latest
This commit is contained in:
@@ -5,6 +5,7 @@ import com.bookstore.service.BookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
@@ -114,4 +115,13 @@ public class BookResource {
|
||||
return book;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/remove", method = RequestMethod.POST)
|
||||
public ResponseEntity remove(
|
||||
@RequestBody String id, Model model
|
||||
){
|
||||
bookService.removeOne(Long.parseLong(id));
|
||||
|
||||
return new ResponseEntity("Remove Success!", HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface BookService {
|
||||
|
||||
List<Book> blurrySearch(String title);
|
||||
|
||||
void removeOne(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -68,4 +68,8 @@ public class BookServiceImpl implements BookService{
|
||||
|
||||
return activeBookList;
|
||||
}
|
||||
|
||||
public void removeOne(Long id) {
|
||||
bookRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user