Personmodel handled as dbtabel and as file
This commit is contained in:
@ -10,6 +10,26 @@ namespace TrackerLibrary.DataAccess
|
||||
public class TextConnector : IDataConnection
|
||||
{
|
||||
private const string PrizesFile = "PrizeModels.csv";
|
||||
private const string PeopleFile = "PersonModels.csv";
|
||||
|
||||
public PersonModel CreatePerson(PersonModel model)
|
||||
{
|
||||
List<PersonModel> people = PeopleFile.FullFilePath().LoadFile().ConvertToPersonModels();
|
||||
|
||||
int currentId = 1;
|
||||
if (people.Count > 0)
|
||||
{
|
||||
currentId = people.OrderByDescending(x => x.Id).First().Id + 1;
|
||||
}
|
||||
|
||||
model.Id = currentId;
|
||||
|
||||
people.Add(model);
|
||||
|
||||
people.SaveToPeopleFile(PeopleFile);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
// TODO - Wire up the createPrize for textFiles
|
||||
public PrizeModel CreatePrize(PrizeModel model)
|
||||
|
||||
Reference in New Issue
Block a user