public void append(Vote_DatabaseModel voteData) { List <Vote_DatabaseModel> contents = this.Load(); contents.Add(voteData); string jsonString = contents.toJson(); System.IO.File.WriteAllText(this._configs.dbJsonPath, jsonString); }
public static VoteModel toModel(Vote_DatabaseModel entity) { VoteModel model = new VoteModel(); if (entity != null) { model.username = entity.username; model.rating = entity.rating; model.comments = entity.comments; } return(model); }
public static Vote_DatabaseModel toDatabaseModel(DateTime voteDate, int beerId, VoteModel model) { Vote_DatabaseModel entity = new Vote_DatabaseModel(); if (model != null) { entity.username = model.username; entity.rating = model.rating; entity.comments = model.comments; entity.voteDate = voteDate; entity.beerId = beerId; } return(entity); }
public static string toJson(this Vote_DatabaseModel model) { return(JsonSerializer.Serialize(model)); }