我的控制器在插入时调用存储库类方法,
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create([Bind(Exclude = "Id")]FormCollection collection)
{
try
{
MaterialsObj materialsObj = new MaterialsObj();
materialsObj.Mat_Name = collection["Mat_Name"];
materialsObj.Mes_Id = Convert.ToInt64(collection["MeasurementType"]);
materialsObj.Mes_Name = collection["Mat_Type"];
materialsObj.CreatedDate = System.DateTime.Now;
materialsObj.CreatedBy = Convert.ToInt64(1);
materialsObj.IsDeleted = Convert.ToInt64(1);
consRepository.createMaterials(materialsObj);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
我的存储库类有这个,
public MaterialsObj createMaterials(MaterialsObj materialsObj)
{
db.Materials.InsertOnSubmit(materialsObj);
return materialsObj;
}
但是当我编译这个我得到The best overloaded method match for 'System.Data.Linq.Table<CrMVC.Models.Material>.InsertOnSubmit(CrMVC.Models.Material)' has some invalid arguments
......
cannot convert from 'CrMVC.BusinessObjects.MaterialsObj' to 'CrMVC.Models.Material'
我错过了什么吗?