3D Crystal ball lamp(Assorted design)
3D Crystal ball lamp(Assorted design)
Regular price
Rs. 545.00
Regular price
Rs. 899.00
Sale price
Rs. 545.00
Unit price
/
per
-39% OFF
package com.example.jali.Controller;
import com.example.jali.cabbooking.Client;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/cabs")
public class HomeController {
private Map<Integer, Client> clients = new HashMap<>();
// Post Mapping for booking a client
@PostMapping("/booking")
public String bookCab(@RequestBody Client client) {
clients.put(client.getId(), client);
return client.toString();
}
// Get Mapping to retrieve client details by ID
@GetMapping("/details/{id}")
public Client getDetail(@PathVariable int id) {
return clients.get(id);
}
// Delete Mapping to cancel a booking
@DeleteMapping("/cancel/{id}")
public String cancelBooking(@PathVariable int id) {
clients.remove(id);
return "Your booking is canceled";
}
}
package com.example.jali.cabbooking;
import java.math.BigInteger;
public class Client {
private int id;
private String time;
private String source;
private String destination;
private String phoneNo;
// Constructor
public Client(int id, String time, String source, String destination, String phoneNo) {
this.id = id;
this.time = time;
this.source = source;
this.destination = destination;
this.phoneNo = phoneNo;
}
// Getters and Setters
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
@Override
public String toString() {
return "Client{" +
"id=" + id +
", time='" + time + '\'' +
", source='" + source + '\'' +
", destination='" + destination + '\'' +
", phoneNo='" + phoneNo + '\'' +
'}';
}
}