ClearOneDalDemo/SettlementAttempt/EfSettlementAttemptDataAccess.cs

39 lines
1.1 KiB
C#
Raw Normal View History

2020-09-15 22:10:53 +00:00
using BinaryDad.AggregateDal.Models;
using System;
namespace BinaryDad.AggregateDal
{
2020-09-15 22:53:28 +00:00
public class EFSettlementAttemptDataAccess : ISettlementAttemptDataAccess
2020-09-15 22:10:53 +00:00
{
public bool AddAttempt(SettlementAttempt attempt)
{
2020-09-15 22:53:28 +00:00
// 1. create attempt in SQL using entity framework
// 2. update the "Id" property/PK of attempt upon insertion
// 3. return if operation is successful
2020-09-15 22:10:53 +00:00
2020-09-15 22:53:28 +00:00
// auto-generated value from PK insert
2020-09-15 22:10:53 +00:00
attempt.Id = 12376;
Console.WriteLine($"Adding attempt ID {attempt.Id} to SQL");
return true;
}
public SettlementAttempt GetAttempt(int recordId)
{
Console.WriteLine($"Getting attempt {recordId} from SQL");
2020-09-15 22:53:28 +00:00
// get the attempt from SQL/EF
2020-09-15 22:10:53 +00:00
return new SettlementAttempt
{
2020-09-15 22:53:28 +00:00
Id = recordId,
RecordId = 9999, // will already be in SQL via webhook
ClientFirstName = "Ryan",
ClientLastName = "Peters",
Created = DateTime.Parse("9/1/2020"),
CreatedBy = "rpeters"
2020-09-15 22:10:53 +00:00
};
}
}
}