public async Task CreateConsultation(ConsultationDto cons) { var provider = await DbContext.GetProviderByProviderIdAsync(cons.ProviderId); var request = await DbContext.GetRequestByIdAsync(cons.RequestId); var member = await DbContext.GetMemberByMemberIdAsync(cons.MemberId); var review = await DbContext.GetReviewByIdAsync(cons.ReviewId); var consult = new Consultation { Request = request, Member = member, EndDt = cons.EndDt, MemberId = member.Id, Provider = provider, ProviderId = provider.Id, RequestId = request.Id, Review = review, ReviewId = review?.Id, StartDt = cons.StartDt }; await DbContext.CreateConsultationAsync(consult); cons.ConsultationId = consult.Id; }
public async Task EndConsultationAsync(ConsultationDto cons, RequestStatus withStatus) { var provider = await DbContext.GetProviderByProviderIdAsync(cons.ProviderId); var request = await DbContext.GetRequestByIdAsync(cons.RequestId); var member = await DbContext.GetMemberByMemberIdAsync(cons.MemberId); var review = await DbContext.GetReviewByIdAsync(cons.ReviewId); var consult = new Consultation { Id = cons.ConsultationId, Request = request, Member = member, EndDt = DateTime.Now, MemberId = member.Id, Provider = provider, ProviderId = provider.Id, RequestId = request.Id, Review = review, ReviewId = review?.Id, StartDt = cons.StartDt }; request.Status = withStatus; await DbContext.SaveRequest(request); await DbContext.UpdateConsultationAsync(consult); }