public async Task <ResultWrapper <GetSupplierFoodsOutput> > Handle(GetSupplierFoodsQuery request, CancellationToken cancellationToken) { ResultWrapper <GetSupplierFoodsOutput> result = new ResultWrapper <GetSupplierFoodsOutput>(); var tDataList = await _dbContext.TFood .Where(x => x.TUserId == request.SupplierId) .ToListAsync(); var list = tDataList.Select(x => new PublicListItem() { Enabled = x.Enabled, Selected = false, Text = x.Title, Value = x.Id.ToString(), Image = x.Image.JoinWithCDNAddress() }) .ToList(); result.Status = true; result.Result = new GetSupplierFoodsOutput() { list = list }; return(result); }
public async Task <IActionResult> GetSupplierFoods() { FirebaseUser user = HttpContext.GetFirebaseUser(); GetSupplierFoodsQuery model = new GetSupplierFoodsQuery() { firebaseId = user.UserId, }; ResultWrapper <GetSupplierFoodsOutput> result = new ResultWrapper <GetSupplierFoodsOutput>(); result = await _mediator.Send(model); return(Ok(result)); }