public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { Response response = null; try { if (!string.IsNullOrEmpty(request.Name)) { using (MemoryStream ms = new MemoryStream()) { await request.File.CopyToAsync(ms); RewardInfo reward = new RewardInfo { Name = request.Name, Icon = ms.ToArray() }; await Repository.Create(reward); response = new Response { Id = reward.Id }; } } else { } } catch (Exception ex) { throw; } return(response); }
public Guid Create(Reward reward) { _repository.Create(Mapping.Mapped.Map <Domain.Entities.Reward>(reward)); return(reward.RewardId); }