This commit is contained in:
Sébastien André
2020-03-04 22:47:43 +01:00
parent 3ac1e67c74
commit 848fdc6b5f
5 changed files with 43 additions and 18 deletions

View File

@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Cors;
using AutoMapper;
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.DataContract;
using AutoMapper;
using skydiveLogs_api.Model;
namespace skydiveLogs_api.Controllers
{
[Route("api/[controller]")]
@@ -24,6 +24,7 @@ namespace skydiveLogs_api.Controllers
// GET: api/Jump
[HttpGet]
[EnableCors]
public IEnumerable<JumpResp> Get()
{
var result = _jumpService.GetAllJumps();
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Controllers
// GET: api/Jump/5
[HttpGet("{id}")]
[EnableCors]
public JumpResp Get(int id)
{
var result = _jumpService.GetJumpById(id);
@@ -40,6 +42,7 @@ namespace skydiveLogs_api.Controllers
// POST: api/Jump
[HttpPost]
[EnableCors]
public void Post([FromBody] JumpReq value)
{
_jumpService.AddNewJump(value.AircraftId,
@@ -51,6 +54,7 @@ namespace skydiveLogs_api.Controllers
// PUT: api/Jump/5
[HttpPut("{id}")]
[EnableCors]
public void Put(int id, [FromBody] JumpReq value)
{
_jumpService.UpdateJump(id, _mapper.Map<Jump>(value));
@@ -58,6 +62,7 @@ namespace skydiveLogs_api.Controllers
// DELETE: api/ApiWithActions/5
[HttpDelete("{id}")]
[EnableCors]
public void Delete(int id)
{
_jumpService.DeleteJumpById(id);