Skip to content

Commit

Permalink
WebApi added
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Enes Aras committed Aug 6, 2021
1 parent c3cdb21 commit ca85a32
Show file tree
Hide file tree
Showing 102 changed files with 13,202 additions and 1 deletion.
Binary file modified .vs/ReCapProject/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
988 changes: 988 additions & 0 deletions .vs/ReCapProject/config/applicationhost.config

Large diffs are not rendered by default.

Binary file modified .vs/ReCapProject/v16/.suo
Binary file not shown.
1 change: 1 addition & 0 deletions Business/Concrete/BrandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public BrandManager(IBrandDal brandDal)
{
_brandDal = brandDal;
}

public IResult Add(Brand brand)
{
_brandDal.Add(brand);
Expand Down
2 changes: 1 addition & 1 deletion Business/Concrete/CarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CarManager(ICarDal carDal)
{
_carDal = carDal;
}

public IResult Add(Car car)
{
if (car.CarName.Length >= 2)
Expand Down
Binary file modified Business/bin/Debug/netstandard2.0/Business.dll
Binary file not shown.
Binary file modified Business/bin/Debug/netstandard2.0/Business.pdb
Binary file not shown.
Binary file modified Business/obj/Debug/netstandard2.0/Business.dll
Binary file not shown.
Binary file modified Business/obj/Debug/netstandard2.0/Business.pdb
Binary file not shown.
6 changes: 6 additions & 0 deletions ReCapProject.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleUI", "ConsoleUI\Cons
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{26D501A3-1C1C-484C-8CEF-3567C9C37249}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "WebAPI\WebAPI.csproj", "{289E1EAE-2907-43C5-B88E-C230772C180B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{26D501A3-1C1C-484C-8CEF-3567C9C37249}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26D501A3-1C1C-484C-8CEF-3567C9C37249}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26D501A3-1C1C-484C-8CEF-3567C9C37249}.Release|Any CPU.Build.0 = Release|Any CPU
{289E1EAE-2907-43C5-B88E-C230772C180B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{289E1EAE-2907-43C5-B88E-C230772C180B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{289E1EAE-2907-43C5-B88E-C230772C180B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{289E1EAE-2907-43C5-B88E-C230772C180B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
75 changes: 75 additions & 0 deletions WebAPI/Controllers/BrandsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using Business.Abstract;
using Entities.Concrete;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class BrandsController : ControllerBase
{
private IBrandService _brandService;
public BrandsController(IBrandService brandService)
{
_brandService = brandService;
}

[HttpPost("add")]
public IActionResult Add(Brand brand)
{
var result = _brandService.Add(brand);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result);
}
[HttpPost("delete")]
public IActionResult Delete(Brand brand)
{
var result = _brandService.Delete(brand);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("update")]
public IActionResult Update(Brand brand)
{
var result = _brandService.Update(brand);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}
[HttpGet("getall")]
public IActionResult GetAll()
{
var result = _brandService.GetAll();
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}

[HttpGet("getbyid")]
public IActionResult GetById(int id)
{
var result = _brandService.GetById(id);
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}
}
}
80 changes: 80 additions & 0 deletions WebAPI/Controllers/CarsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Business.Abstract;
using Business.Concrete;
using DataAccess.Concrete.EntityFramework;
using Entities.Concrete;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController] // attribute
public class CarsController : ControllerBase
{
//Ioc Container -- Inversion of Control
ICarService _carService;

public CarsController(ICarService carService)
{
_carService = carService;
}

[HttpGet("getall")]
public IActionResult GetAll()
{

var result = _carService.GetAll();
if (result.Success)
{
return Ok(result);
}
return BadRequest(result);
}

[HttpPost("add")]
public IActionResult Add(Car car)
{
var result = _carService.Add(car);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result);
}
[HttpGet("getbyid")]
public IActionResult GetById(int id)
{
var result = _carService.GetById(id);
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result);
}
[HttpPost("delete")]
public IActionResult Delete(Car car)
{
var result = _carService.Delete(car);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("update")]
public IActionResult Update(Car car)
{
var result = _carService.Update(car);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}
}
}
79 changes: 79 additions & 0 deletions WebAPI/Controllers/ColorsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Business.Abstract;
using Entities.Concrete;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ColorsController : ControllerBase
{
private IColorService _colorService;

public ColorsController(IColorService colorService)
{
_colorService = colorService;
}

[HttpPost("add")]
public IActionResult Add(Color color)
{
var result = _colorService.Add(color);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("delete")]
public IActionResult Delete(Color color)
{
var result = _colorService.Delete(color);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("update")]
public IActionResult Update(Color color)
{
var result = _colorService.Update(color);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpGet("getall")]
public IActionResult GetAll()
{
var result = _colorService.GetAll();
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}

[HttpGet("getbyid")]
public IActionResult GetById(int id)
{
var result = _colorService.GetById(id);
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}
}
}

78 changes: 78 additions & 0 deletions WebAPI/Controllers/CustomersController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using Business.Abstract;
using Entities.Concrete;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CustomersController : ControllerBase
{
private ICustomerService _customerService;

public CustomersController(ICustomerService customerService)
{
_customerService = customerService;
}

[HttpPost("add")]
public IActionResult Add(Customer customer)
{
var result = _customerService.Add(customer);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("delete")]
public IActionResult Delete(Customer customer)
{
var result = _customerService.Delete(customer);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpPost("update")]
public IActionResult Update(Customer customer)
{
var result = _customerService.Update(customer);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result.Message);
}

[HttpGet("getall")]
public IActionResult GetAll()
{
var result = _customerService.GetAll();
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}

[HttpGet("getbyid")]
public IActionResult GetById(int id)
{
var result = _customerService.GetById(id);
if (result.Success)
{
return Ok(result.Data);
}
return BadRequest(result.Message);
}
}
}
Loading

0 comments on commit ca85a32

Please sign in to comment.