Add a property "IsFavorite" for the drop zone.
This commit is contained in:
@@ -35,9 +35,10 @@ namespace skydiveLogs_api.Business
|
||||
return _dropZoneRepository.GetById(id);
|
||||
}
|
||||
|
||||
public void UpdateDz(int id, DropZone dropZone)
|
||||
public bool UpdateDz(int id, DropZone dropZone)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
dropZone.Id = id;
|
||||
return _dropZoneRepository.Update(dropZone);
|
||||
}
|
||||
|
||||
private readonly IDropZoneRepository _dropZoneRepository;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using skydiveLogs_api.Model;
|
||||
|
||||
namespace skydiveLogs_api.Business.Interface
|
||||
@@ -13,7 +11,7 @@ namespace skydiveLogs_api.Business.Interface
|
||||
|
||||
void DeleteDzById(int id);
|
||||
|
||||
void UpdateDz(int id, DropZone dropZone);
|
||||
bool UpdateDz(int id, DropZone dropZone);
|
||||
|
||||
void AddNewDz(DropZone dropZone);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace skydiveLogs_api.Data
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(Aircraft aircraft)
|
||||
{
|
||||
return _col.Update(aircraft);
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<Aircraft> _col;
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace skydiveLogs_api.Data
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(DropZone updatedDz)
|
||||
{
|
||||
return _col.Update(updatedDz);
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<DropZone> _col;
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace skydiveLogs_api.Data
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(Gear updatedGear)
|
||||
{
|
||||
return _col.Update(updatedGear);
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<Gear> _col;
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace skydiveLogs_api.Data.Interface
|
||||
|
||||
T GetById(int id);
|
||||
|
||||
bool Update(T updated);
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,11 @@ namespace skydiveLogs_api.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool Update(Jump updatedJump)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<Jump> _col;
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace skydiveLogs_api.Data
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(JumpType updatedJumpType)
|
||||
{
|
||||
return _col.Update(updatedJumpType);
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<JumpType> _col;
|
||||
|
||||
@@ -19,5 +19,7 @@ namespace skydiveLogs_api.Model
|
||||
public string Email { get; set; }
|
||||
|
||||
public IEnumerable<string> Type { get; set; }
|
||||
|
||||
public bool IsFavorite { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace skydiveLogs_api.Controllers
|
||||
|
||||
// PUT: api/DropZone/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] DropZoneReq value)
|
||||
public bool Put(int id, [FromBody] DropZoneReq value)
|
||||
{
|
||||
_dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
||||
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
||||
}
|
||||
|
||||
// DELETE: api/ApiWithActions/5
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using AutoMapper;
|
||||
|
||||
using skydiveLogs_api.Business.Interface;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Model;
|
||||
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
public class DropZoneReq
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Latitude { get; set; }
|
||||
|
||||
public string Longitude { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public string Website { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
|
||||
public IEnumerable<string> Type { get; set; }
|
||||
|
||||
public bool IsFavorite { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
@@ -22,5 +19,7 @@ namespace skydiveLogs_api.DataContract
|
||||
public string Email { get; set; }
|
||||
|
||||
public IEnumerable<string> Type { get; set; }
|
||||
|
||||
public bool IsFavorite { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user