public List <EntityFoodie> GetProfiles() { SqlCommand cmd = new SqlCommand("getFoodiesProfiles", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader data = cmd.ExecuteReader(); List <EntityFoodie> foodiesList = new List <EntityFoodie>(); EntityFoodie foodie; while (data.Read()) { foodie = new EntityFoodie(); foodie.Id = int.Parse(data["Id"].ToString()); foodie.Name = data["Name"].ToString(); foodie.Address = data["Address"].ToString(); foodie.CurrentAddress = data["CurrentAddress"].ToString(); foodie.Contact = long.Parse(data["Contact"].ToString()); foodie.PlanId = int.Parse(data["PlanId"].ToString()); foodie.Status = data["Status"].ToString(); foodie.Type = data["Type"].ToString(); foodiesList.Add(foodie); } con.Close(); return(foodiesList); }
public EntityFoodie ModelToEntity(ModelFoodie mFoodie) { EntityFoodie eFoodie = new EntityFoodie(); eFoodie.Id = mFoodie.Id; eFoodie.Name = mFoodie.Name; eFoodie.Contact = mFoodie.Contact; eFoodie.Address = mFoodie.Address; eFoodie.CurrentAddress = mFoodie.CurrentAddress; eFoodie.PlanId = mFoodie.PlanId; eFoodie.Type = mFoodie.Type; eFoodie.Status = mFoodie.Status; return(eFoodie); }
public ModelFoodie EntityToModel(EntityFoodie eFoodie) { ModelFoodie mFoodie = new ModelFoodie(); mFoodie.Id = eFoodie.Id; mFoodie.Name = eFoodie.Name; mFoodie.Contact = eFoodie.Contact; mFoodie.Address = eFoodie.Address; mFoodie.CurrentAddress = eFoodie.CurrentAddress; mFoodie.PlanId = eFoodie.PlanId; mFoodie.Type = eFoodie.Type; mFoodie.Status = eFoodie.Status; return(mFoodie); }