public tblProduct UpdateProduct(tblProduct product) { string sqlQuery = @" UPDATE [dbo].[tblProduct] SET [Item_Number] = '" + product.Item_Number + @"' ,[Item_Group] = '" + product.Item_Group + @"' ,[Description] = '" + product.Description + @"' ,[Customer_Group] = '" + product.Customer_Group + @"' ,[Material_Type] = '" + product.Material_Type + @"' ,[Colors] = '" + product.Colors + @"' ,[Weight] = '" + product.Weight + @"' ,[Dimension] = '" + product.Dimension + @"' ,[Grouping] = '" + product.Grouping + @"' WHERE ProductId ='" + product.ProductId + @"'"; int noOfRowUpdated = _coreDBEntities.Database.ExecuteSqlCommand(sqlQuery); if (noOfRowUpdated > 0) { return(product); } return(null); }
public tblProduct AddProduct(tblProduct product) { _coreDBEntities.tblProducts.Add(product); _coreDBEntities.SaveChanges(); return(product); }