public static Response InsertProductType(string name, string desc)
        {
            ProductType getName = ProductTypeHandler.GetName(name);

            if (name.Length < 5)
            {
                return(new Response(false, "must consist of 5 characters or more"));
            }
            else if (name == "")
            {
                return(new Response(false, "must be filled"));
            }
            else if (getName != null)
            {
                return(new Response(false, "must be unique"));
            }
            else if (desc == "")
            {
                return(new Response(false, "must be filled"));
            }
            else
            {
                ProductTypeHandler.InsertProductType(name, desc);
                return(new Response(true));
            }
        }
        public static Response InsertProductType(string productType, string desc)
        {
            if (productType.Length < 5)
            {
                return(new Response(false, "Product type must be over 5 characters"));
            }
            else if (desc == "")
            {
                return(new Response(false, "Description must be filled."));
            }
            Response response = ProductTypeHandler.InsertProductType(productType, desc);

            return(response);
        }
Esempio n. 3
0
        public static Response InsertProductType(string name, string desc)
        {
            if (name == "" || name.Length < 5)
            {
                return(new Response(false, "Please insert the name and a minimum of 5 character"));
            }
            if (ProductTypeRepository.isUnique(name) == false)
            {
                return(new Response(false, "Product Type Must Be Unique"));
            }
            if (desc == "")
            {
                return(new Response(false, "Please insert the description"));
            }

            return(new Response(ProductTypeHandler.InsertProductType(name, desc), "Product Type has been inserted"));
        }