public GetAllProductsOut GetAllProduct(GetAllProductsIn input) { GetAllProductsOut response = new GetAllProductsOut() { ResponseCode = Entities.Client.General.ResponseCode.Error }; using (IDbConnection connection = new SqlConnection(connectionString)) { connection.Open(); DynamicParameters param = new DynamicParameters(); var data = connection.Query <Product>("SELECT [ProductId] ,[Name] ,[Quantity] ,[Price] ,[CreationDate] FROM [tbl_Product] ORDER BY CreationDate DESC"); var productList = new List <Product>(); foreach (var i in data) { var product = new Product() { ProductId = i.ProductId, Name = i.Name, Quantity = i.Quantity, Price = i.Price, CreationDate = i.CreationDate }; productList.Add(product); } response.product = productList; if (response.product.Count > 0) { response.ResponseCode = Entities.Client.General.ResponseCode.Success; } } return(response); }
public IHttpActionResult GetAllProducts(GetAllProductsIn input) { var response = Product.GetAllProduct(input); return(Ok(response)); }
public GetAllProductsOut GetAllProduct(GetAllProductsIn input) { return(productDA.GetAllProduct(input)); }