public FuelRecordRepository(string connection)
 {
     _context = new FuelTrackerContext(connection);
     if (!_context.DatabaseExists())
     {
         _context.CreateDatabase();
     }
 }
 public CarDetailsViewModel(FuelTrackerContext context, System.Int32 id)
     : this(context)
 {
     if (id <= 0)
     {
         throw new ArgumentException("id must be greater than 0!");
     }
     this.Load(id);
 }
 public FuelRecordDetailsViewModel(FuelTrackerContext context, int id)
     : this(context)
 {
     if (id <= 0)
     {
         throw new ArgumentException("id must be greater than 0!");
     }
     this.Load(id);
 }
 public FuelRecordsListViewModel(FuelTrackerContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("repository must not be null");
     }
     this._context = context;
     //create database if not exists
     if (!_context.DatabaseExists())
     {
         _context.CreateDatabase();
     }
 }
        public CarCreateOrEditViewModel(FuelTrackerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context must not be null");
            }

            this._context = context;
            //create database if not exists
            if (!_context.DatabaseExists())
            {
                _context.CreateDatabase();
            }

            this.Car = new Car();
        }
        private FuelRecordDetailsViewModel(FuelTrackerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context must not be null");
            }

            this._context = context;
            //create database if not exists
            if (!_context.DatabaseExists())
            {
                _context.CreateDatabase();
            }

            this.FuelRecord = new FuelRecord();
        }
        public CarCreateOrEditViewModel(FuelTrackerContext context, System.Int32 id)
            : this(context)
        {
            if (id < 0)
            {
                throw new ArgumentException("id must be greater than 0!");
            }

            if (id == 0)
            {
                this.CreateNew();
            }
            else
            {
                this.Load(id);
            }
        }