Add controler, domain and service about "Tunnel"
This commit is contained in:
76
Back/skydiveLogs-api/Controllers/TunnelController.cs
Normal file
76
Back/skydiveLogs-api/Controllers/TunnelController.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
public class TunnelController : Base
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public TunnelController(ITunnelService tunnelService,
|
||||
IMapper mapper)
|
||||
{
|
||||
_tunnelService = tunnelService;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
// DELETE: api/Tunnel/5
|
||||
//[HttpDelete("{id}")]
|
||||
//[EnableCors]
|
||||
//public void Delete(int id)
|
||||
//{
|
||||
// _tunnelService.DeleteTunnelById(id);
|
||||
//}
|
||||
|
||||
// GET: api/Tunnel
|
||||
[HttpGet]
|
||||
[EnableCors]
|
||||
public IEnumerable<TunnelResp> Get()
|
||||
{
|
||||
var result = _tunnelService.GetAllTunnels();
|
||||
return _mapper.Map<IEnumerable<TunnelResp>>(result);
|
||||
}
|
||||
|
||||
// GET: api/Tunnel/5
|
||||
[HttpGet("{id}")]
|
||||
[EnableCors]
|
||||
public TunnelResp Get(int id)
|
||||
{
|
||||
var result = _tunnelService.GetTunnelById(id);
|
||||
return _mapper.Map<TunnelResp>(result);
|
||||
}
|
||||
|
||||
// POST: api/Tunnel
|
||||
//[HttpPost]
|
||||
//[EnableCors]
|
||||
//public void Post([FromBody] TunnelReq value)
|
||||
//{
|
||||
// _tunnelService.AddNewJumpType(_mapper.Map<Tunnel>(value));
|
||||
//}
|
||||
|
||||
// PUT: api/Tunnel/5
|
||||
//[HttpPut("{id}")]
|
||||
//[EnableCors]
|
||||
//public void Put(int id, [FromBody] TunnelReq value)
|
||||
//{
|
||||
// _tunnelService.UpdateJumpType(id, _mapper.Map<Tunnel>(value));
|
||||
//}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ITunnelService _tunnelService;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user