public virtual async Task <EvlRequestDto> UpdateRank(SubmitRankArgs args, CancellationToken cancellationToken) { EvlRequest evlRequest = await(await EvlRequestsRepository.GetAllAsync(cancellationToken)).FirstOrDefaultAsync(r => r.Id == args.evlRequestId); evlRequest.RankValue = args.Rank; evlRequest.RankDescription = args.Description; return(Mapper.FromEntityToDto((await EvlRequestsRepository.UpdateAsync(evlRequest, cancellationToken)))); }
public virtual async Task <List <EvlRequest> > GetExpertEvlRequests(int expertId, CancellationToken cancellationToken) { return((await EvlRequestsRepository.GetAllAsync(cancellationToken)).Where(r => r.EvlRequestExpert.Expert.ExpertID == expertId).ToList()); }
public virtual async Task <IQueryable <EvlRequestDto> > GetCustomerEvlRequests(CancellationToken cancellationToken) { Guid customerId = Guid.Parse(UserInformationProvider.GetCurrentUserId()); return(Mapper.FromEntityQueryToDtoQuery((await EvlRequestsRepository.GetAllAsync(cancellationToken)).Where(r => r.CustomerId == customerId))); }
public virtual async Task <EvlRequestExpertDto> FindEvlRequestExpert(FindEvlReqeustExpertArgs args, CancellationToken cancellationToken) { EvlRequest evlRequest = await(await EvlRequestsRepository.GetAllAsync(cancellationToken)).Where(e => e.Id == args.requestId).Include(c => c.Customer).FirstOrDefaultAsync(); if (evlRequest == null) { throw new ResourceNotFoundException("evlRequest is null"); } List <EvlRequestFile> requestFiles = await(await EvlRequestFileRepository.GetAllAsync(cancellationToken)).Where(e => e.EvlRequestId == evlRequest.Id).ToListAsync(); HttpClient httpClient = HttpClientFactory.CreateClient("SoltaniHttpClient"); SoltaniFindExpertRequest soltaniFindExpertParams = new SoltaniFindExpertRequest(); soltaniFindExpertParams.UserID = evlRequest.CustomerId; soltaniFindExpertParams.RequestID = evlRequest.Id; soltaniFindExpertParams.Type = (short)evlRequest.InsuranceType; DefaultDateTimeUtils defaultDateTimeUtils = new DefaultDateTimeUtils(); soltaniFindExpertParams.AccidentDate = defaultDateTimeUtils.ConvertMiladiToShamsi(evlRequest.AccidentDate); soltaniFindExpertParams.MapLat = evlRequest.Latitude; soltaniFindExpertParams.MapLng = evlRequest.Longitude; soltaniFindExpertParams.Address = "آدرس تستی"; requestFiles.ForEach(r => soltaniFindExpertParams.Photos.Add(new RequestPhoto { Data = Convert.ToBase64String(r.File), Type = r.TypeId })); if (evlRequest.InsuranceType == Enums.InsuranceType.Badane) { soltaniFindExpertParams.LostName = evlRequest.OwnerFirstName; soltaniFindExpertParams.LostFamily = evlRequest.OwnerLastName; soltaniFindExpertParams.LostInsuranceID = evlRequest.InsurerId; soltaniFindExpertParams.LostCarID = evlRequest.CarId; soltaniFindExpertParams.LostMobile = evlRequest.Customer.Mobile; } else { soltaniFindExpertParams.LostName = evlRequest.LostFirstName; soltaniFindExpertParams.LostFamily = evlRequest.LostLastName; soltaniFindExpertParams.LostMobile = evlRequest.Customer.Mobile; soltaniFindExpertParams.LostCarID = evlRequest.LostCarId; soltaniFindExpertParams.CrmName = evlRequest.OwnerFirstName; soltaniFindExpertParams.CrmFamily = evlRequest.OwnerLastName; soltaniFindExpertParams.CrmInsuranceID = evlRequest.InsurerId; soltaniFindExpertParams.CrmInsuranceNO = evlRequest.InsurerNo; soltaniFindExpertParams.CrmNumberplate = evlRequest.PlateNumber; soltaniFindExpertParams.CrmCarID = evlRequest.CarId; } string json = JsonConvert.SerializeObject(soltaniFindExpertParams); StringContent stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); HttpResponseMessage findExpertRawResponse = await httpClient.PostAsync("FindNearExpert", stringContent); try { findExpertRawResponse.EnsureSuccessStatusCode(); } catch (Exception ex) { throw new DomainLogicException("FindNearExpert call failed", ex); } EvlRequestExpertDto evlRequestExpert = JsonConvert.DeserializeObject <EvlRequestExpertDto>(await findExpertRawResponse.Content.ReadAsStringAsync()); evlRequest.Code = evlRequestExpert.FileID; await EvlRequestsRepository.UpdateAsync(evlRequest, cancellationToken); return(evlRequestExpert); }