Files
constructdemo/ConstructorAppApi/Controllers/FooterController.cs
2025-05-01 15:18:30 +03:00

64 lines
1.8 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using AutoMapper;
using ConstructorApp.BusinessLayer.Abstract;
using ConstructorApp.DtoLayer.FooterDto;
using ConstructorApp.EntityLayer.Entities;
using Microsoft.AspNetCore.Mvc;
namespace ConstructorAppApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FooterController : ControllerBase
{
private readonly IFooterService _footerService;
private readonly IMapper _mapper;
public FooterController(IFooterService footerService, IMapper mapper)
{
_footerService = footerService;
_mapper = mapper;
}
[HttpGet]
public IActionResult FooterList()
{
var value = _footerService.TGetListAll();
var result = _mapper.Map<List<ResultFooterDto>>(value);
return Ok(result);
}
[HttpDelete("{id}")]
public IActionResult DeleteFooter(int id)
{
var value = _footerService.TGetByID(id);
if (value != null)
{
_footerService.TDelete(value);
return Ok("Footer Bilgisi Silindi");
}
return NotFound("Footer Bilgisi Bulunamadı");
}
[HttpPut]
public IActionResult UpdateFooter(UpdateFooterDto updateFooterDto)
{
var value = _mapper.Map<Footer>(updateFooterDto);
_footerService.TUpdate(value);
return Ok("Footer Alanı Güncellendi");
}
[HttpGet("{id}")]
public IActionResult GetFooter(int id)
{
var value = _footerService.TGetByID(id);
if (value != null)
{
var result = _mapper.Map<ResultFooterDto>(value);
return Ok(result);
}
return NotFound("Footer Bilgisi Bulunamadı");
}
}
}