コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public bool FiilUp(Filling entity)
 {
     _repositoryFiiling.Create(entity);
       return true;
 }
コード例 #4
0
        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;
        }
コード例 #5
0
 public void Update(Filling entity)
 {
     throw new NotImplementedException();
 }