public ActionResult Create(profile entry)
        {
            try
            {

                var gender = new SelectList(new[]
                                          {
                                              new {ID="Male",Name="Male"},
                                              new{ID="Female",Name="Female"}
                                          },
              "ID", "Name", 1);
                ViewData["gender"] = gender;
                var semestersList = new SelectList(SRepo.getAll().OrderBy(s => s.semesterName), "id", "semesterName", null);
                ViewData["semestersList"] = semestersList;

                entry.semester.id= 1;
                UpdateModel(entry);
                repo.Add(entry);
                repo.Save();

                return View("Index", repo.GetAll());
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, profile profile)
        {
            profile = repo.GetById(id);

            UpdateModel(profile);

            repo.Save();

            return RedirectToAction("index");
        }
 partial void Deleteprofile(profile instance);
 partial void Updateprofile(profile instance);
 partial void Insertprofile(profile instance);
		private void detach_profiles(profile entity)
		{
			this.SendPropertyChanging();
			entity.semester = null;
		}
		private void attach_profiles(profile entity)
		{
			this.SendPropertyChanging();
			entity.semester = this;
		}
 public void Delete(profile entry)
 {
     db.profiles.DeleteOnSubmit(entry);
 }
 public void Add(profile entry)
 {
     db.profiles.InsertOnSubmit(entry);
 }