Fix
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Cors;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
using skydiveLogs_api.Business.Interface;
|
using skydiveLogs_api.Business.Interface;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Model;
|
using skydiveLogs_api.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@@ -24,6 +24,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Aircraft
|
// GET: api/Aircraft
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableCors]
|
||||||
public IEnumerable<AircraftResp> Get()
|
public IEnumerable<AircraftResp> Get()
|
||||||
{
|
{
|
||||||
var result = _aircraftService.GetAllAircrafts();
|
var result = _aircraftService.GetAllAircrafts();
|
||||||
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Aircraft/5
|
// GET: api/Aircraft/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public AircraftResp Get(int id)
|
public AircraftResp Get(int id)
|
||||||
{
|
{
|
||||||
var result = _aircraftService.GetAircraftById(id);
|
var result = _aircraftService.GetAircraftById(id);
|
||||||
@@ -40,6 +42,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// POST: api/Aircraft
|
// POST: api/Aircraft
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[EnableCors]
|
||||||
public void Post([FromBody] AircraftReq value)
|
public void Post([FromBody] AircraftReq value)
|
||||||
{
|
{
|
||||||
_aircraftService.AddNewAircraft(_mapper.Map<Aircraft>(value));
|
_aircraftService.AddNewAircraft(_mapper.Map<Aircraft>(value));
|
||||||
@@ -47,6 +50,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// PUT: api/Aircraft/5
|
// PUT: api/Aircraft/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] AircraftReq value)
|
public void Put(int id, [FromBody] AircraftReq value)
|
||||||
{
|
{
|
||||||
_aircraftService.UpdateAircraft(id, _mapper.Map<Aircraft>(value));
|
_aircraftService.UpdateAircraft(id, _mapper.Map<Aircraft>(value));
|
||||||
@@ -54,6 +58,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
// DELETE: api/ApiWithActions/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_aircraftService.DeleteAircraftById(id);
|
_aircraftService.DeleteAircraftById(id);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/DropZone/5
|
// GET: api/DropZone/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public DropZoneResp Get(int id)
|
public DropZoneResp Get(int id)
|
||||||
{
|
{
|
||||||
var result = _dropZoneService.GetDzById(id);
|
var result = _dropZoneService.GetDzById(id);
|
||||||
@@ -43,6 +44,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// POST: api/DropZone
|
// POST: api/DropZone
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[EnableCors]
|
||||||
public void Post([FromBody] DropZoneReq value)
|
public void Post([FromBody] DropZoneReq value)
|
||||||
{
|
{
|
||||||
_dropZoneService.AddNewDz(_mapper.Map<DropZone>(value));
|
_dropZoneService.AddNewDz(_mapper.Map<DropZone>(value));
|
||||||
@@ -50,6 +52,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// PUT: api/DropZone/5
|
// PUT: api/DropZone/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public bool Put(int id, [FromBody] DropZoneReq value)
|
public bool Put(int id, [FromBody] DropZoneReq value)
|
||||||
{
|
{
|
||||||
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
||||||
@@ -57,6 +60,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
// DELETE: api/ApiWithActions/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_dropZoneService.DeleteDzById(id);
|
_dropZoneService.DeleteDzById(id);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Cors;
|
||||||
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Gear
|
// GET: api/Gear
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableCors]
|
||||||
public IEnumerable<GearResp> Get()
|
public IEnumerable<GearResp> Get()
|
||||||
{
|
{
|
||||||
var result = _gearService.GetAllGears();
|
var result = _gearService.GetAllGears();
|
||||||
@@ -31,6 +33,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Gear/5
|
// GET: api/Gear/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public GearResp Get(int id)
|
public GearResp Get(int id)
|
||||||
{
|
{
|
||||||
var result = _gearService.GetGearById(id);
|
var result = _gearService.GetGearById(id);
|
||||||
@@ -39,6 +42,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// POST: api/Gear
|
// POST: api/Gear
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[EnableCors]
|
||||||
public void Post([FromBody] GearReq value)
|
public void Post([FromBody] GearReq value)
|
||||||
{
|
{
|
||||||
_gearService.AddNewGear(_mapper.Map<Gear>(value));
|
_gearService.AddNewGear(_mapper.Map<Gear>(value));
|
||||||
@@ -46,6 +50,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// PUT: api/Gear/5
|
// PUT: api/Gear/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] GearReq value)
|
public void Put(int id, [FromBody] GearReq value)
|
||||||
{
|
{
|
||||||
_gearService.UpdateGear(id, _mapper.Map<Gear>(value));
|
_gearService.UpdateGear(id, _mapper.Map<Gear>(value));
|
||||||
@@ -53,6 +58,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
// DELETE: api/ApiWithActions/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_gearService.DeleteGearById(id);
|
_gearService.DeleteGearById(id);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Cors;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
using skydiveLogs_api.Business.Interface;
|
using skydiveLogs_api.Business.Interface;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using AutoMapper;
|
|
||||||
using skydiveLogs_api.Model;
|
using skydiveLogs_api.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@@ -24,6 +24,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Jump
|
// GET: api/Jump
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableCors]
|
||||||
public IEnumerable<JumpResp> Get()
|
public IEnumerable<JumpResp> Get()
|
||||||
{
|
{
|
||||||
var result = _jumpService.GetAllJumps();
|
var result = _jumpService.GetAllJumps();
|
||||||
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/Jump/5
|
// GET: api/Jump/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public JumpResp Get(int id)
|
public JumpResp Get(int id)
|
||||||
{
|
{
|
||||||
var result = _jumpService.GetJumpById(id);
|
var result = _jumpService.GetJumpById(id);
|
||||||
@@ -40,6 +42,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// POST: api/Jump
|
// POST: api/Jump
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[EnableCors]
|
||||||
public void Post([FromBody] JumpReq value)
|
public void Post([FromBody] JumpReq value)
|
||||||
{
|
{
|
||||||
_jumpService.AddNewJump(value.AircraftId,
|
_jumpService.AddNewJump(value.AircraftId,
|
||||||
@@ -51,6 +54,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// PUT: api/Jump/5
|
// PUT: api/Jump/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] JumpReq value)
|
public void Put(int id, [FromBody] JumpReq value)
|
||||||
{
|
{
|
||||||
_jumpService.UpdateJump(id, _mapper.Map<Jump>(value));
|
_jumpService.UpdateJump(id, _mapper.Map<Jump>(value));
|
||||||
@@ -58,6 +62,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
// DELETE: api/ApiWithActions/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_jumpService.DeleteJumpById(id);
|
_jumpService.DeleteJumpById(id);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Cors;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
using skydiveLogs_api.Business.Interface;
|
using skydiveLogs_api.Business.Interface;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using AutoMapper;
|
|
||||||
using skydiveLogs_api.Model;
|
using skydiveLogs_api.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@@ -24,6 +24,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/JumpType
|
// GET: api/JumpType
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableCors]
|
||||||
public IEnumerable<JumpTypeResp> Get()
|
public IEnumerable<JumpTypeResp> Get()
|
||||||
{
|
{
|
||||||
var result = _jumpTypeService.GetAllJumpTypes();
|
var result = _jumpTypeService.GetAllJumpTypes();
|
||||||
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// GET: api/JumpType/5
|
// GET: api/JumpType/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public JumpTypeResp Get(int id)
|
public JumpTypeResp Get(int id)
|
||||||
{
|
{
|
||||||
var result = _jumpTypeService.GetJumpTypeById(id);
|
var result = _jumpTypeService.GetJumpTypeById(id);
|
||||||
@@ -40,6 +42,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// POST: api/JumpType
|
// POST: api/JumpType
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[EnableCors]
|
||||||
public void Post([FromBody] JumpTypeReq value)
|
public void Post([FromBody] JumpTypeReq value)
|
||||||
{
|
{
|
||||||
_jumpTypeService.AddNewJumpType(_mapper.Map<JumpType>(value));
|
_jumpTypeService.AddNewJumpType(_mapper.Map<JumpType>(value));
|
||||||
@@ -47,6 +50,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// PUT: api/JumpType/5
|
// PUT: api/JumpType/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] JumpTypeReq value)
|
public void Put(int id, [FromBody] JumpTypeReq value)
|
||||||
{
|
{
|
||||||
_jumpTypeService.UpdateJumpType(id, _mapper.Map<JumpType>(value));
|
_jumpTypeService.UpdateJumpType(id, _mapper.Map<JumpType>(value));
|
||||||
@@ -54,6 +58,7 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
// DELETE: api/ApiWithActions/5
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_jumpTypeService.DeleteJumpTypeById(id);
|
_jumpTypeService.DeleteJumpTypeById(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user