Fix about the favorite DZ
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
{
|
||||
public class FavoriteDropZone
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DropZone DropZone { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
|
||||
@@ -30,13 +30,12 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
public IEnumerable<DropZone> GetAllDzs(User connectedUser)
|
||||
{
|
||||
var results = Enumerable.Empty<DropZone>();
|
||||
|
||||
|
||||
var dropzones = _dropZoneRepository.GetAll();
|
||||
var favorites = _favoriteDropZoneRepository.GetAll(connectedUser);
|
||||
|
||||
|
||||
results = from dropZone in dropzones
|
||||
join favorite in favorites on dropZone equals favorite.DropZone into tmp
|
||||
join favorite in favorites on dropZone.Id equals favorite.DropZone.Id into tmp
|
||||
from favoriteDz in tmp.DefaultIfEmpty()
|
||||
select new DropZone
|
||||
{
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace skydiveLogs_api.Ioc
|
||||
_services.AddScoped<IGearRepository, GearRepository>();
|
||||
_services.AddScoped<IUserRepository, UserRepository>();
|
||||
_services.AddScoped<IUserImageRepository, UserImageRepository>();
|
||||
|
||||
_services.AddScoped<IFavoriteDropZoneRepository, FavoriteDropZoneRepository>();
|
||||
|
||||
string connectionString = _configuration.GetConnectionString("DefaultConnection");
|
||||
_services.AddSingleton<IDataProvider>(c => new LiteDbProvider(connectionString));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace skydiveLogs_api.Controllers
|
||||
}
|
||||
|
||||
// PUT: api/DropZone/AddToFavorite/5
|
||||
[HttpPut("{id}")]
|
||||
[HttpPut("AddToFavorite/{id}")]
|
||||
[EnableCors]
|
||||
public bool AddToFavorite(int id)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace skydiveLogs_api.Controllers
|
||||
}
|
||||
|
||||
// PUT: api/DropZone/RemoveToFavorite/15
|
||||
[HttpPut("{id}")]
|
||||
[HttpPut("RemoveToFavorite/{id}")]
|
||||
[EnableCors]
|
||||
public bool RemoveToFavorite(int id)
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace skydiveLogs_api.Controllers
|
||||
_jumpService.UpdateJump(id, _mapper.Map<Jump>(value));
|
||||
}
|
||||
|
||||
// DELETE: api/ApiWithActions/5
|
||||
// DELETE: api/Jump/5
|
||||
[HttpDelete("{id}")]
|
||||
[EnableCors]
|
||||
public void Delete(int id)
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace skydiveLogs_api.Controllers
|
||||
}
|
||||
|
||||
// GET: api/User/AlwayLogin
|
||||
[HttpGet("AlwayLogin")]
|
||||
[HttpGet("AlwaysLogin")]
|
||||
[EnableCors]
|
||||
public IActionResult AlwayLogin()
|
||||
public IActionResult AlwaysLogin()
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
|
||||
<NameOfLastUsedPublishProfile>C:\Projects\SkydiveLogs\Back\skydiveLogs-api\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
<ActiveDebugProfile>skydiveLogs_api</ActiveDebugProfile>
|
||||
<ActiveDebugProfile>IIS Express</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
|
||||
Reference in New Issue
Block a user