Exemplo n.º 1
0
        public async Task UpdateComplaintAsync(Guid complaintId, ComplaintUpdateModel complaint)
        {
            ArgumentGuard.NotNull(complaintId, nameof(complaintId));
            ArgumentGuard.NotNull(complaint, nameof(complaint));

            var dbComplaint = await _complaintRepository.GetAsync(complaintId);

            if (dbComplaint.IsNull())
            {
                throw new Exception("Complaint not found");
            }

            var complaintEntity = Mapper.Map <ComplaintEntity>(complaint);

            complaintEntity.Id             = complaintId;
            complaintEntity.Status         = dbComplaint.Status;
            complaintEntity.UserId         = dbComplaint.UserId;
            complaintEntity.ProductId      = dbComplaint.ProductId;
            complaintEntity.CreatedTimeUtc = dbComplaint.CreatedTimeUtc;

            await _complaintRepository.UpdateAsync(complaintEntity);
        }
Exemplo n.º 2
0
 public async Task UpdateComplaintAsync(Guid complaintId, [FromForm] ComplaintUpdateModel complaint)
 {
     await _complaintService.UpdateComplaintAsync(complaintId, complaint);
 }