Exemplo n.º 1
0
 private RideDataModel MapToDataModel(RideCreateViewModel model)
 {
     return(new RideDataModel()
     {
         Date = model.Date,
         from = model.from,
         to = model.to,
         seat = model.seat,
         description = model.description
     });
 }
Exemplo n.º 2
0
        public async Task <int> AddAsync(RideCreateViewModel model)
        {
            var dataModel = MapToDataModel(model);

            dataModel.isActive   = true;
            dataModel.createTime = DateTimeOffset.Now.ToUnixTimeSeconds();
            await _repository.AddAsync(dataModel);

            _unitOfWork.SaveChanges();

            return(dataModel.id);
        }
Exemplo n.º 3
0
        public IActionResult AddRide(RideCreateViewModel data)
        {
            var success = _rideManager.AddAsync(data);

            return(Ok(success));
        }