My controller calls a repository class method on insert,
[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();
}
}
and my repository class has this,
public MaterialsObj createMaterials(MaterialsObj materialsObj)
{
db.Materials.InsertOnSubmit(materialsObj);
return materialsObj;
}
But when i compile this i get 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'
..
am i missing something?