public AppDbContext(DbContextOptions <AppDbContext> options) : base(options) { Database.EnsureCreated(); if (!Offers.Any()) { DbInitializer.Seed(this); } }
/// <summary> /// Format the result according to the spec /// </summary> /// <returns>The formatted result</returns> public override string ToString() { var sb = new StringBuilder(); sb.AppendLine($"Subtotal: {SubTotal.ToCustomFormatString()}"); foreach (var offer in Offers) { sb.AppendLine($"{offer.Description}: {offer.PriceDelta.ToCustomFormatString()}"); } if (!Offers.Any()) { sb.AppendLine("(No offers available)"); } sb.AppendLine($"Total: {Total.ToCustomFormatString()}"); return(sb.ToString()); }