public async Task <EventHistoryBllModel> AddAsync(EventHistoryBllModel eventHistory)
        {
            var newEventHistory = _mapper.Map <EventHistory>(eventHistory);
            await _unitOfWork.EventHistoryRepository.AddAsync(newEventHistory);

            await _unitOfWork.SaveChangesAsync();

            return(_mapper.Map <EventHistoryBllModel>(newEventHistory));
        }
        public async Task UpdateAsync(int id, EventHistoryBllModel eventHistory)
        {
            var entity = await _unitOfWork.EventHistoryRepository.FindAsyncDefault(s => s.Id == id);

            if (entity == null)
            {
                return;
            }
            entity.Date     = eventHistory.Date;
            entity.Distance = eventHistory.Distance;
            entity.Name     = eventHistory.Name;
            _unitOfWork.EventHistoryRepository.Update(entity);
            await _unitOfWork.SaveChangesAsync();
        }
        public async Task <EventHistoryBllModel> AddAsync(double distance, DateTime date, string name)
        {
            var newEventHistory = new EventHistoryBllModel();

            newEventHistory.Distance = distance;
            newEventHistory.Name     = name;
            newEventHistory.Date     = date;

            await _unitOfWork.EventHistoryRepository.AddAsync(_mapper.Map <EventHistory>(newEventHistory));

            await _unitOfWork.SaveChangesAsync();

            return(newEventHistory);
        }