Add project files.

This commit is contained in:
2025-05-01 15:18:30 +03:00
parent e058ab8015
commit 774d695414
3094 changed files with 1336814 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
using AutoMapper;
using ConstructorApp.BusinessLayer.Abstract;
using ConstructorApp.DtoLayer.TestimonialDto;
using ConstructorApp.EntityLayer.Entities;
using Microsoft.AspNetCore.Mvc;
namespace ConstructorAppApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TestimonialController : ControllerBase
{
private readonly ITestimonialService _testimonialService;
private readonly IMapper _mapper;
public TestimonialController(ITestimonialService testimonialService, IMapper mapper)
{
_testimonialService = testimonialService;
_mapper = mapper;
}
[HttpGet]
public IActionResult TestimonialList()
{
var value = _testimonialService.TGetListAll();
var result = _mapper.Map<List<ResultTestimonialDto>>(value);
return Ok(result);
}
[HttpPost]
public IActionResult CreateTestimonial(CreateTestimonialDto createTestimonialDto)
{
var value = _mapper.Map<Testimonial>(createTestimonialDto);
_testimonialService.TAdd(value);
return Ok("Yorum Bilgisi Eklendi");
}
[HttpDelete("{id}")]
public IActionResult DeleteTestimonial(int id)
{
var value = _testimonialService.TGetByID(id);
if (value != null)
{
_testimonialService.TDelete(value);
return Ok("Yorum Bilgisi Silindi");
}
return NotFound("Yorum Bilgisi Bulunamadı");
}
[HttpPut]
public IActionResult UpdateTestimonial(UpdateTestimonialDto updateTestimonialDto)
{
var value = _mapper.Map<Testimonial>(updateTestimonialDto);
_testimonialService.TUpdate(value);
return Ok("Yorum Alanı Güncellendi");
}
[HttpGet("{id}")]
public IActionResult GetTestimonial(int id)
{
var value = _testimonialService.TGetByID(id);
if (value != null)
{
var result = _mapper.Map<ResultTestimonialDto>(value);
return Ok(result);
}
return NotFound("Yorum Bilgisi Bulunamadı");
}
[HttpGet("TestimonialStatusActive/{id}")]
public IActionResult TestimonialStatusActive(int id)
{
_testimonialService.TTestimonialStatusActive(id);
return Ok("Ürün Kategorisi Aktif Hale Getirildi");
}
[HttpGet("TestimonialStatusPassive/{id}")]
public IActionResult TestimonialStatusPassive(int id)
{
_testimonialService.TTestimonialStatusPassive(id);
return Ok("Ürün Kategorisi Pasif Hale Getirildi");
}
[HttpGet("CountAll")]
public IActionResult CountAll()
{
return Ok(_testimonialService.TCountAll());
}
}
}