public void NewClaim(MitchellClaimType claim) { using (AutoClaimEntityFrameworkContext dbContext = new AutoClaimEntityFrameworkContext()) { dbContext.Claims.Add(claim); dbContext.SaveChanges(); } }
public void DeleteClaim(string claimNumber) { using (AutoClaimEntityFrameworkContext dbContext = new AutoClaimEntityFrameworkContext()) { MitchellClaimType claim = (from c in dbContext.Claims.Include("LossInfo").Include("Vehicles") where c.ClaimNumber == claimNumber select c).FirstOrDefault(); if (claim == null) { Console.WriteLine("Invalid claim update, claim with claim number: " + claimNumber + " does not exist in database"); } dbContext.Claims.Remove(claim); dbContext.SaveChanges(); } }