Reputation: 71
Getting three errors:
cannot convert from 'employer' to 'JobPortalModel.employer'
The best overloaded method match for System.Data.Objects.ObjectSet.AddObject (JobPortalModel.employer)' has some invalid arguments
'employer' does not contain a definition for 'c_type' and no
extension method
'c_type' accepting a first argument of type 'employer' could be
found (are you missing a using directive or an assembly reference
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JobPortalModel;
public partial class Reg_employer : System.Web.UI.Page
{
JobPortalEntities je1= new JobPortalEntities();
protected void Page_Load(object sender, EventArgs e)
{
acctyp.Text = Session["Account"].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
string Type = acctyp.Text;
string Name = txtname.Text;
string Email = txtmail.Text;
string Password = txtpass.Text;
string RePassword = txtrepass.Text;
string Details = txtdtls.Text;
string Website = txtwbst.Text;
string Image=fplg.FileName;
string ext = System.IO.Path.GetExtension(Image).ToLower();
if (ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".jpg")
{
string sp = Server.MapPath("~") + "\\logo//" + Image;
fplg.SaveAs(sp);
string ps = "~/logo/" + Image;
employer e2=new employer();
e2.c_type = Type;
e2.c_name = Name;
e2.c_mail = Email;
e2.c_pass = Password;
e2.c_repass = RePassword;
e2.c_details = Details;
e2.c_website = Website;
e2.c_img = ps;
je1.employer.AddObject(e2);
je1.SaveChanges();
}
Response.Redirect("Default.aspx");
}
private string conv(string p)
{
throw new NotImplementedException();
}
}
Upvotes: 1
Views: 153
Reputation: 7943
Looks like you have an employer class somewhere, which is conflicting with JobPortalModel.employer. You can do like this:
//employer e2=new employer();
JobPortalModel.employer e2=new JobPortalModel.employer();
You need to be careful about naming variables. Change this:
string Type = acctyp.Text;
... ... ...
string Image=fplg.FileName;
To this:
string type = acctyp.Text;
... ... ...
string image=fplg.FileName;
And change this:
string sp = Server.MapPath("~") + "\\logo//" + Image;
... ... ...
string ps = "~/logo/" + Image;
... ... ...
e2.c_type = Type;
To this:
string sp = Server.MapPath("~") + "\\logo//" + image;
... ... ...
string ps = "~/logo/" + image;
... ... ...
e2.c_type = type;
You can find Microsoft's naming guideline here.
Upvotes: 1