55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using AutoMapper;
|
|
using Complex.Application.Complex;
|
|
using Complex.Application.Utility;
|
|
using Complex.Common.Dto;
|
|
using Complex.EndPoint.Utility;
|
|
using Complex.EndPoint.ViewModel;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Complex.EndPoint.Controllers
|
|
{
|
|
[ApiController]
|
|
[ApiVersion("1")]
|
|
[Route("api/v{version:apiVersion}/[controller]/[action]")]
|
|
//[Route("[controller]/[action]")]
|
|
[Authorize]
|
|
public class ComplexController : Controller
|
|
{
|
|
private readonly IComplexService _complexService;
|
|
private IMapper _mapper;
|
|
|
|
public ComplexController(IComplexService complexService, IMapper mapper)
|
|
{
|
|
_complexService = complexService;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
//[HttpPost]
|
|
//public ResultDto<int> InsertComplex(ComplexViewModel complexVm)
|
|
//{
|
|
// return _complexService.InsertComplex(_mapper.Map<ComplexDto>(complexVm));
|
|
//}
|
|
|
|
[HttpPost]
|
|
public ResultDto<ComplexDto> EditComplex(ComplexViewModel complexVm)
|
|
{
|
|
return _complexService.EditComplex(User.GetUserId(),_mapper.Map<ComplexDto>(complexVm));
|
|
}
|
|
|
|
[HttpGet]
|
|
public ResultDto<ComplexDto> ComplexProperties(Guid Id)
|
|
{
|
|
var complexdto = _complexService.ComplexProperties(Id);
|
|
return complexdto;
|
|
}
|
|
[HttpGet]
|
|
public ResultDto<List<ComplexDto>> ComplexList()
|
|
{
|
|
var MobileNumber = User.GetUserId();
|
|
return _complexService.ComplexList(MobileNumber);
|
|
}
|
|
|
|
}
|
|
}
|