Пример #1
0
 public IList <MitchellClaimType> FindClaims(DateTime lossDateFrom, DateTime lossDateTo)
 {
     using (AutoClaimEntityFrameworkContext dbContext = new AutoClaimEntityFrameworkContext())
     {
         return((from c in dbContext.Claims where c.LossDate >= lossDateFrom && c.LossDate <= lossDateTo select c).ToList());
     }
 }
Пример #2
0
 public void NewClaim(MitchellClaimType claim)
 {
     using (AutoClaimEntityFrameworkContext dbContext = new AutoClaimEntityFrameworkContext())
     {
         dbContext.Claims.Add(claim);
         dbContext.SaveChanges();
     }
 }
Пример #3
0
 public MitchellClaimType ReadClaim(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 read, claim with claim number: " + claimNumber + " does not exist in database");
         }
         return(claim);
     }
 }
Пример #4
0
 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();
     }
 }