Skip to content
Snippets Groups Projects

admin controller and html

2 files
+ 222
0
Compare changes
  • Side-by-side
  • Inline
Files
2
package com.cardiff.client_project.controller.admin;
import com.cardiff.client_project.pojo.dto.HospitalDTO;
import com.cardiff.client_project.service.CommonAdminHospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/commonAdmin/hospital")
public class CommonAdminHospitalController {
@Autowired
private CommonAdminHospitalService commonAdminHospitalService;
@GetMapping("/all")
public List<HospitalDTO> getAllHospitals() {
return commonAdminHospitalService.getAllHospitals();
}
@PostMapping("/add")
public ResponseEntity<String> addHospital(@RequestBody HospitalDTO hospital) {
commonAdminHospitalService.addHospital(hospital);
return ResponseEntity.ok("Hospital added successfully!");
}
@PutMapping("/update")
public ResponseEntity<String> updateHospital(@RequestBody HospitalDTO hospital) {
commonAdminHospitalService.updateHospital(hospital);
return ResponseEntity.ok("Hospital updated successfully!");
}
@DeleteMapping("/delete/{id}")
public ResponseEntity<String> deleteHospital(@PathVariable int id) {
commonAdminHospitalService.deleteHospital(id);
return ResponseEntity.ok("Hospital deleted successfully!");
}
}
Loading