private RideDataModel MapToDataModel(RideCreateViewModel model) { return(new RideDataModel() { Date = model.Date, from = model.from, to = model.to, seat = model.seat, description = model.description }); }
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); }
public IActionResult AddRide(RideCreateViewModel data) { var success = _rideManager.AddAsync(data); return(Ok(success)); }