Implementation to have a favorite DZ by user.

This commit is contained in:
Sébastien André
2021-03-24 18:04:08 +01:00
parent beee601a57
commit 0a6dbf42e4
12 changed files with 255 additions and 194 deletions

View File

@@ -25,7 +25,7 @@ namespace skydiveLogs_api.Controllers
[EnableCors]
public IEnumerable<DropZoneResp> Get()
{
var result = _dropZoneService.GetAllDzs();
var result = _dropZoneService.GetAllDzs(ConnectedUser);
return _mapper.Map<IEnumerable<DropZoneResp>>(result);
}
@@ -56,7 +56,7 @@ namespace skydiveLogs_api.Controllers
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
}
// DELETE: api/ApiWithActions/5
// DELETE: api/ApiWithActions
[HttpDelete("{id}")]
[EnableCors]
public void Delete(int id)
@@ -64,6 +64,22 @@ namespace skydiveLogs_api.Controllers
_dropZoneService.DeleteDzById(id);
}
// PUT: api/DropZone/AddToFavorite/5
[HttpPut("{id}")]
[EnableCors]
public bool AddToFavorite(int id)
{
return _dropZoneService.AddToFavorite(id, ConnectedUser);
}
// PUT: api/DropZone/RemoveToFavorite/15
[HttpPut("{id}")]
[EnableCors]
public bool RemoveToFavorite(int id)
{
return _dropZoneService.RemoveToFavorite(id, ConnectedUser);
}
private readonly IDropZoneService _dropZoneService;
private readonly IMapper _mapper;
}