public NavBarVcModel CreateNavBarVcModel(Session_Data mSessionData) { return(new NavBarVcModel() { CartItemCount = mSessionData.CartItemCount, HasMessages = mSessionData.HasMessages, HasNotifications = mSessionData.HasNotifications }); }
public async Task <Session_Data> GetSession(string userId) { using var log = BeginFunction(nameof(SessionUserService), nameof(GetSession), userId); try { //AssertIsEndUser(userId); await Assert(SecurityPolicy.IsAuthorized, userId).ConfigureAwait(false); //using var ctx = QuiltContextFactory.Create(); var participantReference = CreateParticipantReference.FromUserId(userId); var participantId = await CommunicationMicroService.AllocateParticipantAsync(participantReference).ConfigureAwait(false); var svcSummary = await CommunicationMicroService.GetSummaryAsync(participantId).ConfigureAwait(false); var result = new Session_Data { HasNotifications = svcSummary.HasNotifications, HasMessages = svcSummary.HasMessages }; //var ordererReference = CreateOrdererReference.FromUserId(userId); //var dbOrdererPendingOrder = ctx.OrdererPendingOrders.SingleOrDefault(r => r.Orderer.OrdererReference == ordererReference); // HACK: OrderStatus /* * result.CartItemCount = dbOrdererPendingOrder == null * ? 0 * : dbOrdererPendingOrder.Order.OrderItems.Where(r => r.OrderItemStatusTypeCode == OrderItemStatusTypes.Pending).Count(); */ log.Result(result); return(result); } catch (Exception ex) { log.Exception(ex); throw; } }