public async Task CreateOrEdit(CreateOrEditTrainDto input) { if (input.Id == null) { await Create(input); } else { await Update(input); } }
protected virtual async Task Create(CreateOrEditTrainDto input) { var train = ObjectMapper.Map <Train>(input); if (AbpSession.TenantId != null) { train.TenantId = (int)AbpSession.TenantId; } await _trainRepository.InsertAsync(train); }
protected virtual async Task Update(CreateOrEditTrainDto input) { var train = await _trainRepository.FirstOrDefaultAsync((Guid)input.Id); ObjectMapper.Map(input, train); }