cont

mail@pastecode.io avatar
unknown
java
2 years ago
1.9 kB
2
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.business.abstracts.MaintanenceService;
import com.takipArac.wsTakipArac.core.utilities.results.Result;
import com.takipArac.wsTakipArac.entities.Maintanence;

@RestController
@RequestMapping("/api/1.0/adminCompany/maintanences")
public class MaintanenceController {
	
	private MaintanenceService maintanenceService;

	@Autowired
	public MaintanenceController(MaintanenceService maintanenceService) {
		super();
		this.maintanenceService = maintanenceService;
	}
	
	@PostMapping("/add")
	public Result maintanenceAdd(@Valid @RequestBody Maintanence maintanence) {
		return this.maintanenceService.maintanenceAdd(maintanence);
		
	}
	
	@GetMapping("/getAll")
	public Result maintanenceGetAll() {
		return this.maintanenceService.maintanenceGetAll();
	}
	
	@GetMapping("/getBycarId")
	public Result maintanenceGetBycarId(int carId) {
		return this.maintanenceService.getBycarId(carId);
	}
	
	@DeleteMapping("/delete")
	public Result maintanenceDelete(int maintanenceId) {
		return this.maintanenceService.maintanenceDelete(maintanenceId);
	}

	@PutMapping("/update")
	public Result maintanenceUpdate(@Valid @RequestBody Maintanence maintanence) {
		return this.maintanenceService.maintanenceUpdate(maintanence);
	}
	

}