public void Create(Filling entity)
        {
            if (!this.CheckDb)
              {
            return;
              }

              var str = "\n"+entity.Meleage + "," + entity.Amount + "," + entity.PricePerLitr.ToString("F0") + "," + entity.ExchangeRate.ToString("F0") + "," +
                entity.Date.Value.ToString("dd.MM.yyyy");
              File.AppendAllText(_dbPath, str);
        }
        public IHttpActionResult Post([FromBody] FillUp requst)
        {
            var filling = new Filling
              {
            Amount = requst.Amount,
            Date = requst.Date ?? DateTime.Now,
            IsFull = requst.IsFull,
            Meleage = requst.Meleage,
            PricePerLitr = requst.PricePerLitr,
            ExchangeRate = _currencyService.AnotherDayByCode(requst.Date.GetValueOrDefault(), 840).Price
              };

              _serviceFillingUp.FiilUp(filling);

              return Ok();
        }
 public bool FiilUp(Filling entity)
 {
     _repositoryFiiling.Create(entity);
       return true;
 }
        private IEnumerable<Filling> ExecuteFromFile()
        {
            var str = File.ReadAllLines(_dbPath).Skip(1);
              var result = new List<Filling>();
              var i = 0;
              foreach (var row in str)
              {
            var param = row.Split(new[] {','});
            var localFilling = new Filling
            {
              ID = i++,
              Meleage = Int32.Parse(param[0]),
              Amount = Decimal.Parse(param[1]),
              PricePerLitr = Decimal.Parse(param[2]),
              ExchangeRate = Decimal.Parse(param[3]),
              Date = DateTime.ParseExact(param[4], "dd.MM.yyyy",null)
            };

            result.Add(localFilling);
              }

              return result;
        }
 public void Update(Filling entity)
 {
     throw new NotImplementedException();
 }