Update the repsitories to know the "Add" function
This commit is contained in:
@@ -32,7 +32,7 @@ namespace skydiveLogs_api.Data
|
||||
return _col.Update(aircraft);
|
||||
}
|
||||
|
||||
public bool AddAircraft(Aircraft newAircraft)
|
||||
public bool Add(Aircraft newAircraft)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace skydiveLogs_api.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<Aircraft> _col;
|
||||
|
||||
@@ -32,6 +32,22 @@ namespace skydiveLogs_api.Data
|
||||
return _col.Update(updatedDz);
|
||||
}
|
||||
|
||||
public bool Add(DropZone newDz)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
try
|
||||
{
|
||||
_col.Insert(newDz);
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<DropZone> _col;
|
||||
|
||||
@@ -32,6 +32,22 @@ namespace skydiveLogs_api.Data
|
||||
return _col.Update(updatedGear);
|
||||
}
|
||||
|
||||
public bool Add(Gear newGear)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
try
|
||||
{
|
||||
_col.Insert(newGear);
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<Gear> _col;
|
||||
|
||||
@@ -5,6 +5,5 @@ namespace skydiveLogs_api.Data.Interface
|
||||
{
|
||||
public interface IAircraftRepository : IRepository<Aircraft>
|
||||
{
|
||||
bool AddAircraft(Aircraft newAircraft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,5 @@ namespace skydiveLogs_api.Data.Interface
|
||||
{
|
||||
public interface IJumpRepository : IRepository<Jump>
|
||||
{
|
||||
bool AddJump(Jump newJump);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,7 @@ namespace skydiveLogs_api.Data.Interface
|
||||
T GetById(int id);
|
||||
|
||||
bool Update(T updated);
|
||||
|
||||
bool Add(T newEntity);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace skydiveLogs_api.Data
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool AddJump(Jump newJump)
|
||||
public bool Add(Jump newJump)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
|
||||
@@ -32,6 +32,22 @@ namespace skydiveLogs_api.Data
|
||||
return _col.Update(updatedJumpType);
|
||||
}
|
||||
|
||||
public bool Add(JumpType newJumpType)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
try
|
||||
{
|
||||
_col.Insert(newJumpType);
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
private readonly LiteCollection<JumpType> _col;
|
||||
|
||||
Reference in New Issue
Block a user