Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
        }