public static Response UpdateProduct(int id, string name, int price, int stock, int productTypeId) { ProductType pt = ProductTypeHandler.GetProductTypeById(productTypeId); if (name == "") { return(new Response(false, "must be filled")); } else if (stock < 1) { return(new Response(false, "input must be 1 or more")); } else if (price < 1000) { return(new Response(false, "input must be above 1000")); } else if (price % 1000 != 0) { return(new Response(false, "input must be multiply of 1000")); } else if (pt == null) { return(new Response(false, "product type does not exist")); } else { ProductHandler.UpdateProduct(id, name, price, stock, productTypeId); return(new Response(true)); } }
public static ProductType GetProductTypeById(int id) { ProductType pt = ProductTypeHandler.GetProductTypeById(id); return(pt); }