This commit is contained in:
Le Deng
2017-03-06 10:49:55 -05:00
parent 1773aff4e3
commit 41cd750b8d
15 changed files with 209 additions and 39 deletions

View File

@@ -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);
}
}

View File

@@ -19,4 +19,6 @@ public interface BookService {
List<Book> blurrySearch(String title);
void removeOne(Long id);
}

View File

@@ -68,4 +68,8 @@ public class BookServiceImpl implements BookService{
return activeBookList;
}
public void removeOne(Long id) {
bookRepository.delete(id);
}
}