Ann K
asked on
Name space syntax error
Van you help me in that error
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for ProductTypeTypeModel
/// </summary>
public class ProductTypeModel
{
public string InsertProductType(ProductType productType)
{
try
{
GarageDBEntities db = new GarageDBEntities();
db.ProductTypes.Add(productType);
db.SaveChanges();
return productType.Name + "was successfully inserted";
}
catch (Exception e)
{
return "Error:" + e;
}
}
public string UpdateProductType(int id, ProductType productType)
{
try
{
GarageDBEntities db = new GarageDBEntities();
// Fetch object from db
ProductType p = db.ProductTypes.Find(id);
p.Name = productType.Name;
db.SaveChanges();
return productType.Name + "was successfully updated";
}
catch (Exception e)
{
return "Error:" + e;
}
}
public string DeleteProductType(int id)
{
try
{
GarageDBEntities db = new GarageDBEntities();
ProductType productType = db.ProductTypes.Find(id);
db.ProductTypes.Attach(productType);
db.ProductTypes.Remove(productType);
db.SaveChanges();
return productType.Name + "was successfully deleted";
}
catch (Exception e)
{
return "Error:" + e;
}
}
}
does it give you any options if you right mouse click on it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Ann,
Please use like below-
Add a reference of the project in which you have defined the ProductModelType. I think that it GarbageManager to your current project.
And use like ..
GarbageManager.ProductMode lType
Hope it helps!
Please use like below-
Add a reference of the project in which you have defined the ProductModelType. I think that it GarbageManager to your current project.
And use like ..
GarbageManager.ProductMode
Hope it helps!
Try this...
Using ProductTypeModel;
Using ProductTypeModel;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How to I do that?
Go to btnSubmit_Click
SELECT first 2 lines and press delete button. And copy paste the below line there-
ProductTypeModel.ProductTy pe pt = new ProductTypeModel.ProductTy pe();
SELECT first 2 lines and press delete button. And copy paste the below line there-
ProductTypeModel.ProductTy
mouse over it and a blue box should appear at the beginning of that line. if you click on that it should give you a drop down to implement the namespace.