public int updateProductCategory(ProductCategoryDOM product) { int result = 0; try { String sql = "UPDATE Product_Category SET "; sql += "Type = @Type, Description = '', Deleted = @Deleted "; sql += "WHERE ID = @ID"; SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); SqlCommand cmd = new SqlCommand(sql, connection); cmd.Parameters.AddWithValue("@ID", product.ID[0]); cmd.Parameters.AddWithValue("@Type", product.Type[0]); cmd.Parameters.AddWithValue("@Description", product.Description[0]); cmd.Parameters.AddWithValue("@Deleted", product.Deleted[0]); connection.Open(); result = (int)cmd.ExecuteScalar(); connection.Close(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(0); } return(result); }
public ActionResult Menu() { product = productDA.selectALLCategory(); return(PartialView(product)); }