Implement the function "Add a aircraft"
This commit is contained in:
@@ -15,9 +15,9 @@ namespace skydiveLogs_api.Business
|
|||||||
_aircraftRepository = aircraftRepository;
|
_aircraftRepository = aircraftRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewAircraft(Aircraft aircraft)
|
public void AddNewAircraft(Aircraft newAircraft)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_aircraftRepository.AddAircraft(newAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteAircraftById(int id)
|
public void DeleteAircraftById(int id)
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ namespace skydiveLogs_api.Business
|
|||||||
{
|
{
|
||||||
dropZone.Id = id;
|
dropZone.Id = id;
|
||||||
|
|
||||||
//dropZone.Address = dropZone.Address ?? string.Empty;
|
|
||||||
//dropZone.Website = dropZone.Address ?? string.Empty;
|
|
||||||
//dropZone.Email = dropZone.Address ?? string.Empty;
|
|
||||||
|
|
||||||
return _dropZoneRepository.Update(dropZone);
|
return _dropZoneRepository.Update(dropZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,23 @@ namespace skydiveLogs_api.Data
|
|||||||
return _col.Update(aircraft);
|
return _col.Update(aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AddAircraft(Aircraft newAircraft)
|
||||||
|
{
|
||||||
|
var result = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_col.Insert(newAircraft);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
private readonly LiteCollection<Aircraft> _col;
|
private readonly LiteCollection<Aircraft> _col;
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ namespace skydiveLogs_api.Data.Interface
|
|||||||
{
|
{
|
||||||
public interface IAircraftRepository : IRepository<Aircraft>
|
public interface IAircraftRepository : IRepository<Aircraft>
|
||||||
{
|
{
|
||||||
|
bool AddAircraft(Aircraft newAircraft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
namespace skydiveLogs_api.DataContract
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.DataContract
|
|
||||||
{
|
{
|
||||||
public class AircraftReq
|
public class AircraftReq
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user