42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using LFlow.Base.Interfaces;
|
|
using LFlow.Base.Utils;
|
|
using LFlow.Home.Models.DataModels;
|
|
|
|
|
|
// using LFlow.Interfaces;
|
|
using LFlow.Home.Models.DtoModel;
|
|
using LFlow.Base.BusinessInterface;
|
|
using Serilog;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LFlow.Home.Services;
|
|
|
|
public class HomeService(IRepo<HomeModel, string> repo, ILogger logger) : BaseController, IHomeService<HomeDto?, string>
|
|
{
|
|
[HttpGet]
|
|
public HomeDto? DeleteById(string id)
|
|
{
|
|
var result = repo.Delete(id);
|
|
return Mapper.Map<HomeDto>(result);
|
|
}
|
|
[HttpGet]
|
|
public HomeDto? GetById(string id)
|
|
{
|
|
logger.Information($"GetById id -> {id}");
|
|
var result = repo.Get(id);
|
|
return Mapper.Map<HomeDto>(result);
|
|
}
|
|
[HttpPost]
|
|
public HomeDto? Save(HomeDto entity)
|
|
{
|
|
var result = repo.SaveOrUpdate(Mapper.Map<HomeModel>(entity), false);
|
|
return Mapper.Map<HomeDto>(result);
|
|
}
|
|
[HttpGet]
|
|
public List<HomeDto>? Search(HomeDto whereObj)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|