public static void AddCarEntity(CarEntity c)
 {
     Cars.Add(new CarEntity(c));
     if (Cars.Count() > 3)
     {
         using (var db = new DBContext())
         {
             db.Cars.AddRange(Cars);
             db.SaveChanges();
             Cars.Clear();
         }
     }
 }
Exemplo n.º 2
0
 public CarEntity(CarEntity c)
 {
     this.Title       = c.Title;
     this.PictureOne  = c.PictureOne;
     this.PictureTwo  = c.PictureTwo;
     this.PictureTree = c.PictureTree;
     this.HorsePower  = c.HorsePower;
     this.Engine      = c.Engine;
     this.Color       = c.Color;
     this.MileAge     = c.MileAge;
     this.tradeMark   = c.tradeMark;
     this.model       = c.model;
     this.gearBox     = c.gearBox;
     this.fuel        = c.fuel;
 }
Exemplo n.º 3
0
 public new bool Equals(object x, object y)
 {
     if (x.GetType() != y.GetType())
     {
         return(false);
     }
     else
     {
         CarEntity xc = (CarEntity)x;
         CarEntity yc = (CarEntity)y;
         if (xc.tradeMark == yc.tradeMark &&
             xc.model == yc.model &&
             xc.gearBox == yc.gearBox &&
             xc.fuel == yc.fuel &&
             xc.Engine == yc.Engine &&
             xc.MileAge == yc.MileAge &&
             xc.HorsePower == yc.HorsePower &&
             xc.Title.Equals(yc.Title))
         {
             return(true);
         }
     }
     return(false);
 }