initial
This commit is contained in:
31
SettlementAttempt/EfSettlementAttemptDataAccess.cs
Normal file
31
SettlementAttempt/EfSettlementAttemptDataAccess.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using BinaryDad.AggregateDal.Models;
|
||||
using System;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class EfSettlementAttemptDataAccess : ISettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt)
|
||||
{
|
||||
// create attempt in SQL
|
||||
|
||||
attempt.Id = 12376;
|
||||
|
||||
Console.WriteLine($"Adding attempt ID {attempt.Id} to SQL");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public SettlementAttempt GetAttempt(int recordId)
|
||||
{
|
||||
// get the attempt from SQL
|
||||
|
||||
Console.WriteLine($"Getting attempt {recordId} from SQL");
|
||||
|
||||
return new SettlementAttempt
|
||||
{
|
||||
Id = recordId
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
21
SettlementAttempt/ISettlementAttemptDataAccess.cs
Normal file
21
SettlementAttempt/ISettlementAttemptDataAccess.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using BinaryDad.AggregateDal.Models;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public interface ISettlementAttemptDataAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a new settlement attempt
|
||||
/// </summary>
|
||||
/// <param name="attempt"></param>
|
||||
/// <returns>Whether the add operation was successful</returns>
|
||||
bool AddAttempt(SettlementAttempt attempt);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an existing settlement attempt
|
||||
/// </summary>
|
||||
/// <param name="recordId"></param>
|
||||
/// <returns></returns>
|
||||
SettlementAttempt GetAttempt(int recordId);
|
||||
}
|
||||
}
|
31
SettlementAttempt/QuickBaseSettlementAttemptDataAccess.cs
Normal file
31
SettlementAttempt/QuickBaseSettlementAttemptDataAccess.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using BinaryDad.AggregateDal.Models;
|
||||
using System;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class QuickBaseSettlementAttemptDataAccess : ISettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt)
|
||||
{
|
||||
attempt.RecordId = 9999;
|
||||
|
||||
// create attempt in Quickbase
|
||||
|
||||
Console.WriteLine($"Adding attempt ID {attempt.RecordId} to Quickbase with SQL ID {attempt.Id}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public SettlementAttempt GetAttempt(int recordId)
|
||||
{
|
||||
// get the attempt from Quickbase
|
||||
|
||||
Console.WriteLine($"Getting attempt {recordId} from Quickbase");
|
||||
|
||||
return new SettlementAttempt
|
||||
{
|
||||
Id = recordId
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
11
SettlementAttempt/SettlementAttemptDataAccess.cs
Normal file
11
SettlementAttempt/SettlementAttemptDataAccess.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using BinaryDad.AggregateDal.Models;
|
||||
using System.Linq;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class SettlementAttemptDataAccess : AggregateDataAccess<ISettlementAttemptDataAccess>, ISettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt) => Invoke(d => d.AddAttempt(attempt));
|
||||
public SettlementAttempt GetAttempt(int recordId) => Invoke(d => d.GetAttempt(recordId));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user