public static int GetTypeId(string typeName) { ProductTypeDao productTypeDao = new ProductTypeDao(); int typeId = productTypeDao.GetTypeId(typeName); if (typeId > 0) { return(typeId); } ProductTypeInfo productTypeInfo = new ProductTypeInfo(); productTypeInfo.TypeName = typeName; return((int)productTypeDao.Add(productTypeInfo, null)); }
public static int GetTypeId(string typeName) { ProductTypeDao productTypeDao = new ProductTypeDao(); int typeId = productTypeDao.GetTypeId(typeName); int result; if (typeId > 0) { result = typeId; } else { result = productTypeDao.AddProductType(new ProductTypeInfo { TypeName = typeName }); } return(result); }