public async Task <ResultWrapper <GetSupplierOutput> > Handle(GetSupplierQuery request, CancellationToken cancellationToken) { ResultWrapper <GetSupplierOutput> result = new ResultWrapper <GetSupplierOutput>(); var tData = await _dbContext.TUser .Include(x => x.TRegionCity) .ThenInclude(x => x.TRegionState) .ThenInclude(x => x.TRegionCountry) .FirstOrDefaultAsync(x => x.Role == Infrastructure.AppEnums.RoleEnum.Supplier && x.Id == request.Id); result.Status = true; result.Result = new GetSupplierOutput() { Id = tData.Id, Email = tData.Email, Address = tData.Address, FireBaseId = tData.FireBaseId, FirstName = tData.FirstName, LastName = tData.LastName, Gender = tData.Gender, Phone = tData.Phone, PostalCode = tData.PostalCode, RegionCityId = tData.TRegionCityId ?? 0, RegionStateId = tData.TRegionCity?.TRegionStateId ?? 0, RegionCountryId = tData.TRegionCity?.TRegionState?.TRegionCountryId ?? 0, RestaurantName = tData.RestaurantName, ShareAccount = tData.ShareAccount, SharePercent = tData.SharePercent, Lat = tData.Lat, Lng = tData.Lng }; return(result); }
public async Task <ActionResult> GetSupplier([FromQuery] GetSupplierQuery query) { var response = await _mediator.Send(query); if (response.Status.IsSuccessful) { return(Ok(response)); } return(BadRequest(response)); }
public async Task <IActionResult> GetSupplier(int id) { FirebaseUser user = HttpContext.GetFirebaseUser(); GetSupplierQuery model = new GetSupplierQuery() { firebaseId = user.UserId, Id = id }; ResultWrapper <GetSupplierOutput> result = new ResultWrapper <GetSupplierOutput>(); result = await _mediator.Send(model); return(Ok(result)); }
public async Task <IActionResult> GetSupplier(GetSupplierQuery supplierQuery) { return(Ok(await Mediator.Send(supplierQuery))); }