conrtrt

mail@pastecode.io avatar
unknown
java
2 years ago
2.1 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.fasterxml.jackson.annotation.JsonView;
import com.takipArac.wsTakipArac.business.abstracts.CompanyService;
import com.takipArac.wsTakipArac.core.utilities.results.Result;
import com.takipArac.wsTakipArac.core.utilities.shared.Views;
import com.takipArac.wsTakipArac.entities.Company;
import com.takipArac.wsTakipArac.entities.dtos.CompanyWithAddressDto;

@RestController
public class CompanyController {
	
	private CompanyService companyService;

	@Autowired
	public CompanyController(CompanyService companyService) {
		super();
		this.companyService = companyService;
	}
	
	/*
	 * @PostMapping("/api/1.0/admin/companies/add") public Result
	 * companyAdd(@Valid @RequestBody Company company) { return
	 * this.companyService.companyAdd(company);
	 * 
	 * }
	 */
	
	@PostMapping("/api/1.0/admin/companies/add")
	public Result companyAdd(@Valid @RequestBody CompanyWithAddressDto companywithAddressDto) {
		
		return this.companyService.companyWithAddressDto(companywithAddressDto);
		
	}
	@GetMapping("/api/1.0/admin/companies/getAll")
	public Result companyGetAll() {
		return this.companyService.companyGetAll();
	}
	
	@DeleteMapping("/api/1.0/admin/companies/delete")
	public Result companyDelete(int companyId) {
		return this.companyService.companyDelete(companyId);
	}

	@PutMapping("/api/1.0/adminCompany/companies/update")
	public Result companyUpdate(@Valid @RequestBody Company company) {
		return this.companyService.companyUpdate(company);
	}

}