/* * This constructor instantiates the DbContext that is used during the * lifetime of this application * This constructor should be used when a new form is created */ public SolaApplicationService() { Context = new SolaDbContext(); app = new Application(); app.StartDate = DateTime.Today; app.Parties.Add(new Party() { PartyType = "ContactPerson" }); }
public SolaApplicationService(int ApplicationId) { Context = new SolaDbContext(); var getApp = Context.Applications.Where(p => p.Id == ApplicationId); if (getApp != null) { app = getApp.FirstOrDefault(); } else { throw new Exception("No application is found with that ID...cheers"); } }