Beispiel #1
0
 private static void RemoveRecordByld(int carld, byte[] timestamp)
 {
     using (var repo = new inventoryRepo())
     {
         repo.Delete(carld, timestamp);
     }
 }
Beispiel #2
0
 private static void RemoveRecordByCar(inventory carToDelete)
 {
     using (var repo = new inventoryRepo())
     {
         repo.Delete(carToDelete);
     }
 }
Beispiel #3
0
 private static void AddNewRecord(inventory car)
 {
     // Добавить запись в таблицу Inventory базы данных AutoLot.
     using (var repo = new inventoryRepo())
     {
         repo.Add(car);
     }
 }
    public List <InventoryRecord> Getlnventory()
    {
        var repo    = new inventoryRepo();
        var records = repo.GetAll();
        var results = this.config.CreateMapper().Map <List <InventoryRecord> >(records);

        repo.Dispose();
        return(results);
    }
    public void InsertCar(string make, string color, string petname)
    {
        var repo = new inventoryRepo();

        repo.Add(new inventory {
            Color = color, Make = make, PetName = petname
        });
        repo.Dispose();
    }
    public List <InventoryRecord> GetInventory()
    {
        var repo    = new inventoryRepo();
        var records = repo.GetAll();
        var results = Mapper.Map <List <InventoryRecord> >(records);

        repo.Dispose();
        return(results);
    }
    public void InsertCar(InventoryRecord car)
    {
        var repo = new inventoryRepo();

        repo.Add(new inventory {
            Color = car.Color, Make = car.Make, PetName = car.PetName
        });
        repo.Dispose();
    }
Beispiel #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Using a Repository *****\n");
            using (var repo = new inventoryRepo())
            {
                foreach (inventory c in repo.GetAll())
                {
                    Console.WriteLine(c);
                }
            }

            ReadLine();
        }
Beispiel #9
0
 private static void UpdateRecord(int carld)
 {
     using (var repo = new inventoryRepo())
     {
         // Извлечь запись об автомобиле, изменить ее и сохранить.
         var carToUpdate = repo.GetOne(carld);
         if (carToUpdate == null)
         {
             return;
         }
         carToUpdate.Color = "Blue";
         repo.Save(carToUpdate);
     }
 }