I'm new to mvc.Before i used to code with entity framewok and it's easy.But i have to do some different things.I have looked some tutorials but i couldn't understand very well and they don't cover my needs. I connected my Visual studio and got data from oracle 12c successfully using by Oracle Data Provider for .net,not by using entity framework.Code is at above.
string constr = "Data Source=localhost/orcl;User Id=HOSPITAL;Password=HOSPITAL;";
OracleConnection conn = new OracleConnection();
OracleCommand cmd;
OracleDataAdapter da;
conn.ConnectionString = constr;
OracleCommandBuilder cb;
DataSet ds;
conn.Open();
string sql = "Select * from BABY
IDENTITY.FIRSTNAME,IDENTITY.LASTNAME,IDENTITY.MOTHERNAME,IDENTITY.FATHERNAME,
IDENTITY.BIRTHDAY,IDENTITY.GENDER,BABY.WEIGHT,BABY.HEIGHT FROM BABY
INNER JOIN IDENTITY ON BABY.FILE_NO=IDENTITY.FILE_NO";
cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
da = new OracleDataAdapter(cmd);
cb = new OracleCommandBuilder(da);
ds = new DataSet();
da.Fill(ds);
conn.Close();
I want to bind this data to my model and display at view.My model is as the following class.
public class Baby
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthday { get; set; }
public string FatherName { get; set; }
public string MotherName { get; set; }
public string Gender { get; set; }
public int Height { get; set; }
public int Weight { get; set; }
}
How can we bind dataset to my model or how can i bind my query result directly to my model?