public async Task CreateRecord(RecordViewModel model) { model.Id = Guid.NewGuid().ToString(); model.AddedAt = DateTime.UtcNow; model.Location.RecordId = model.Id; var entity = _mapper.Map <Record>(model); await _repository.Create(entity); }
public async Task <Unit> Handle(CreateRecordCommand request, CancellationToken cancellationToken) { var entity = _mapper.Map <CreateRecordCommand, Record>(request); entity.Id = Guid.NewGuid(); entity.AddedAt = DateTime.UtcNow; entity.Location.RecordId = entity.Id; await _repository.Create(entity); return(Unit.Value); }