public async Task <HistoryShopCart> GetLstHistoryShoppingCart([FromQuery] HistoryShoppingCart model) { var output = new HistoryShopCart(); output.Data = await _repoWrapper.ShoppingCart.GetHistoryShopingCart(model); CountHistoryShoppingCart countModel = new CountHistoryShoppingCart(); countModel.UserId = model.UserId; countModel.ProductBrandId = model.ProductBrandId; countModel.ShopingCartCode = model.ShopingCartCode; countModel.FromDate = model.FromDate; countModel.ToDate = model.ToDate; output.HistoryCount = await _repoWrapper.ShoppingCart.GetCountHistoryShopingCart(countModel); return(output); }
public async Task <List <HistoryShopingCart_Result> > GetHistoryShopingCart(HistoryShoppingCart model) { var pUserId = new SqlParameter("@UserId", model.UserId ?? (object)DBNull.Value); var pProductBrandId = new SqlParameter("@ProductBrandId", model.ProductBrandId ?? (object)DBNull.Value); var pShopingCartCode = new SqlParameter("@ShopingCartCode", model.ShopingCartCode ?? (object)DBNull.Value); var pShopingCartMasterId = new SqlParameter("@ShopingCartMasterId", model.ShopingCartMasterId ?? (object)DBNull.Value); var pShopingCartDetailId = new SqlParameter("@ShopingCartDetailId", model.ShopingCartDetailId ?? (object)DBNull.Value); var pStatusCart = new SqlParameter("@StatusCart", model.StatusCart ?? (object)DBNull.Value); var pFromDate = new SqlParameter("@FromDate", model.FromDate ?? (object)DBNull.Value); var pToDate = new SqlParameter("@ToDate", model.ToDate ?? (object)DBNull.Value); var pPageSize = new SqlParameter("@PageSize", model.PageSize ?? 1); var pCurrentPage = new SqlParameter("@CurrentPage", model.CurrentPage ?? 20); try { var output = await HanomaContext.Set <HistoryShopingCart_Result>() .FromSqlRaw($"EXECUTE dbo.HistoryShopingCart " + $"@UserId = @UserId, " + $"@ProductBrandId = @ProductBrandId, " + $"@ShopingCartCode = @ShopingCartCode, " + $"@ShopingCartMasterId = @ShopingCartMasterId, " + $"@ShopingCartDetailId = @ShopingCartDetailId, " + $"@StatusCart = @StatusCart, " + $"@FromDate = @FromDate, " + $"@ToDate = @ToDate, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage ", pUserId, pProductBrandId, pShopingCartCode, pShopingCartMasterId, pShopingCartDetailId, pStatusCart, pFromDate, pToDate, pPageSize, pCurrentPage ) .AsNoTracking() .ToListAsync(); return(output); } catch (Exception ex) { } return(new List <HistoryShopingCart_Result>()); }