Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.8 kB
1
Indexable
Never
package com.takipArac.wsTakipArac.api.controllers;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.takipArac.wsTakipArac.core.utilities.results.DataResult;
import com.takipArac.wsTakipArac.business.abstracts.CarService;
import com.takipArac.wsTakipArac.core.utilities.results.Result;
import com.takipArac.wsTakipArac.entities.Car;

@RestController

public class CarController {
	
	private CarService carService;

	@Autowired
	public CarController(CarService carService) {
		super();
		this.carService = carService;
	}
	
	@PostMapping("/api/1.0/adminCompany/cars/add")
	public Result carAdd(@Valid @RequestBody Car car) {
		return this.carService.carAdd(car);
		
	}
	@GetMapping("/api/1.0/adminCompany/cars/getAll")
	public Result carGetAll() {
		return this.carService.carGetAll();
	}
	
	@DeleteMapping("/api/1.0/adminCompany/cars/delete")
	public Result carDelete(int carId) {
		return this.carService.carDelete(carId);
	}

	@PutMapping("/api/1.0/all/cars/update")
	public Result carUpdate(@Valid @RequestBody Car car) {
		return this.carService.carUpdate(car);
	}
	
	@GetMapping("/api/1.0/adminCompany/cars/carId")			
	public DataResult<Car> getBycarId(int carId){
		return this.carService.getBycarId(carId);
	}

}