public ActionResult AddTopic(ForumTopic forumTopic) { //string[] splits = values.Split(':'); //ForumTopic forumTopic = new ForumTopic(); //if (splits.Length == 3) //{ // forumTopic.Category = splits[0]; // forumTopic.Name = splits[1]; // forumTopic.Description = splits[2]; //} string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); forumTopic.createdUser = myprofile; //forumTopic.groupId = ViewBag.GroupID; ViewBag.CategoryList = followPeersDB.Specializations.Select(s => s.SpecializationName).ToList(); if (ModelState.IsValid && forumTopic.Category != null && forumTopic.Category != "") { var toAddInto = followPeersDB.Forums.Single(f => f.Category == forumTopic.Category); toAddInto.Topics.Add(forumTopic); followPeersDB.SaveChanges(); ViewBag.TopicAdded = "true"; } Console.WriteLine(forumTopic.createdUser.FirstName); return RedirectToAction("TopicDetail", "Forum", new { id = forumTopic.ForumTopicId }); //return View(forumTopic); }
// // GET: /Event/ public ActionResult Index() { myprofile = db.UserProfiles.SingleOrDefault(p => p.UserName == name); //return View(); var result = from n in db.Events orderby n.EventDateTime ascending select n; return View(result.ToList()); }
public ActionResult Edit(UserProfile userprofile) { if (ModelState.IsValid) { db.Entry(userprofile).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(userprofile); }
public ActionResult Create(UserProfile userprofile) { if (ModelState.IsValid) { db.UserProfiles.Add(userprofile); db.SaveChanges(); return RedirectToAction("Index"); } return View(userprofile); }
public void AddTag(Tag model) { myprofile = db.UserProfiles.SingleOrDefault(p => p.UserName == name); if (ModelState.IsValid) { // Add only if tag doesn't already exist Tag Check = db.Tags.FirstOrDefault(p => p.TagName == model.TagName); if (Check == null) { db.Tags.Add(model); db.Entry(model).State = EntityState.Modified; db.SaveChanges(); } return; } }
public void AddTag(string TagName) { myprofile = db.UserProfiles.SingleOrDefault(p => p.UserName == name); if (ModelState.IsValid) { Tag Check = db.Tags.FirstOrDefault(p => p.TagName == TagName); if (Check == null) { Tag item = new Tag(); item.TagName = TagName; db.Tags.Add(item); db.Entry(item).State = EntityState.Modified; db.SaveChanges(); } return; } }
// // GET: /Default1/ public ActionResult AppliedGroup(int id) { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); // UserProfile followerProfile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username); // UserProfile followerProfile = new UserProfile(); Group group = followPeersDB.Groups.SingleOrDefault(p => p.GroupId == id); bool x = false; if (group.Members.Contains(myprofile) && myprofile.Groups.Contains(group)) { group.Members.Remove(myprofile); myprofile.Groups.Remove(group); followPeersDB.SaveChanges(); x = true; } else { group.Members.Add(myprofile); myprofile.Groups.Add(group); followPeersDB.SaveChanges(); } UserProfile updateowner = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserProfileId == group.OwnerId); string grouptitle = group.Name; string makeMessage = ""; if (x == false) makeMessage = myprofile.FirstName + " Joined group : " + grouptitle; else makeMessage = myprofile.FirstName + " UnJoined group : " + grouptitle; Notification newnoti = new Notification { message = makeMessage, link = "/Profile/Index/" + myprofile.UserProfileId, New = true, imagelink = myprofile.PhotoUrl, }; updateowner.Notifications.Add(newnoti); followPeersDB.Entry(updateowner).State = EntityState.Modified; followPeersDB.SaveChanges(); return RedirectToAction("Index"); }
public string MarkNotificationsasSeen() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); foreach (var noti in myprofile.Notifications) { noti.New = false; } followPeersDB.SaveChanges(); return ""; }
public string GetNumberofNewNoti() { int count = 0; string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); foreach (var noti in myprofile.Notifications) { if (noti.New == true) { count++; } } if (count == 0) return ""; return count.ToString(); }
public void Follow(string username, string url) { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); // UserProfile followerProfile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username); // UserProfile followerProfile = new UserProfile(); Relationship tempR = new Relationship { personAName = name, personBName = username, tier = myprofile.Default //setting the default tier }; followPeersDB.Relationships.Add(tempR); followPeersDB.SaveChanges(); UserProfile personB = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username); UserProfile follower = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); Notification newnoti = new Notification { message = follower.FirstName + " started following you.", link = "/Profile/Index/" + follower.UserProfileId, New = true, imagelink = myprofile.PhotoUrl, }; personB.Notifications.Add(newnoti); followPeersDB.Entry(personB).State = EntityState.Modified; followPeersDB.SaveChanges(); Response.Redirect(url); // return RedirectToAction("Index", "Profile", new { id = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username).UserProfileId }); }
public ActionResult EditPortfolio(string message) { if (message != null) ViewData["message"] = message; string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); ViewBag.CountryId = new SelectList(followPeersDB.Countries, "CountryId", "Name"); return View(myprofile); }
public ActionResult CreateGroup(string name, string[] members) { string myname = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == myname); Group grp = new Group { Name = name, OwnerId = myprofile.UserProfileId, Members = new List<UserProfile>() }; if (members == null || members.Count() == 0) return RedirectToAction("Index", "Bulletin", new { sort = 3 }); for (int i = 0; i < members.Count(); i++) { string tempstr = members[i]; IQueryable<UserProfile> custQuery = from cust in followPeersDB.UserProfiles where cust.FirstName + " " + cust.LastName == tempstr select cust; foreach (var profile in custQuery) { grp.Members.Add(profile); } } followPeersDB.Groups.Add(grp); followPeersDB.SaveChanges(); return RedirectToAction("Index", "Bulletin", new { sort = 3 }); }
private void UpdateStudent(string[] Name, string[] Type, string[] StartYear, string[] EndYear, string[] About, string[] Link, UserProfile userprofile) { int count = userprofile.Students.Count(); for (int i = 0; i < count; i++) { Student tempStu = userprofile.Students.ElementAt(0); followPeersDB.Students.Remove(tempStu); // userprofile.Educations.Remove(tempEdu); } if (Name != null) { for (int i = 0; i < Name.Count(); i++) { if (Name != null) { string tempName = Name.ElementAt(i); string tempStart = StartYear.ElementAt(i); string tempEnd = EndYear.ElementAt(i); string tempType = Type.ElementAt(i); string tempAbout = About.ElementAt(i); string tempUserId = Link.ElementAt(i); Student tempStu = new Student { Name = tempName, Type = Convert.ToInt16(tempType), StartYear = Convert.ToInt16(tempStart), EndYear = Convert.ToInt16(tempEnd), About = tempAbout, Link = Convert.ToInt16(tempUserId) }; userprofile.Students.Add(tempStu); tempStu.UserProfile = userprofile; } } } }
public void UnBookmark(string jobid, string url) { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); int jobidINT = Convert.ToInt16(jobid); // UserProfile followerProfile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username); // UserProfile followerProfile = new UserProfile(); Job job = followPeersDB.Jobs.SingleOrDefault(p => p.JobId == jobidINT); myprofile.Jobs.Remove(job); followPeersDB.SaveChanges(); Response.Redirect(url); // return RedirectToAction("Index", "Profile", new { id = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username).UserProfileId }); }
public ActionResult AddMembertoGroup(string name, string grpname) { string myname = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == myname); UserProfile profile = followPeersDB.UserProfiles.SingleOrDefault(p => p.FirstName + " " + p.LastName == name); IQueryable<Group> custQuery = from cust in followPeersDB.Groups where cust.OwnerId == myprofile.UserProfileId select cust; foreach (var grp in custQuery) { if (grp.Members.Contains(profile)) { if (grp.Name == grpname) { return RedirectToAction("Index", "Bulletin", new { sort = 3 }); } grp.Members.Remove(profile); } if (grp.Members.Count() == 0) followPeersDB.Groups.Remove(grp); } Group Togrp = followPeersDB.Groups.SingleOrDefault(p => p.OwnerId == myprofile.UserProfileId & p.Name == grpname); //come back here Togrp.Members.Add(profile); followPeersDB.SaveChanges(); return RedirectToAction("Index", "Bulletin", new { sort = 3 }); }
private void UpdatePortfolio(string[] Name, string[] Field, string[] Country, string[] Year, string[] Status, string[] Website, string[] MoreInfo, UserProfile userprofile) { int count = userprofile.Portfolios.Count(); for (int i = 0; i < count; i++) { Portfolio tempCompany = userprofile.Portfolios.ElementAt(0); followPeersDB.Portfolios.Remove(tempCompany); // userprofile.Educations.Remove(tempEdu); } if (Name != null) { for (int i = 0; i < Name.Count(); i++) { string tempName = Name.ElementAt(i); string tempField = Field.ElementAt(i); string tempCountry = Country.ElementAt(i); string tempYear = Year.ElementAt(i); string tempStatus = Status.ElementAt(i); string tempWebsite = Website.ElementAt(i); string tempMoreInfo = MoreInfo.ElementAt(i); Portfolio tempPort = new Portfolio { Name = tempName, BusinessField = tempField, Country = tempCountry, Year = Convert.ToInt16(tempYear), Status = tempStatus, Website = tempWebsite, MoreInfo = tempMoreInfo }; userprofile.Portfolios.Add(tempPort); tempPort.UserProfile = userprofile; } } }
private void UpdateSpecializations(int[] Specialization, UserProfile userprofile) { if (Specialization != null) { var selectedSpecializations = new HashSet<int>(Specialization); var existingSpecializations = new HashSet<int> (userprofile.Specializations.Select(c => c.SpecializationId)); foreach (var s in followPeersDB.Specializations) { //if new choices match with the database entries if (selectedSpecializations.Contains(s.SpecializationId)) { //if existing choices do not contain, add this new if (!existingSpecializations.Contains(s.SpecializationId)) { userprofile.Specializations.Add(s); s.UserProfiles.Add(userprofile); } } else { if (existingSpecializations.Contains(s.SpecializationId)) { userprofile.Specializations.Remove(s); Keyword temp = userprofile.Keywords.SingleOrDefault(p => p.Area == s.SpecializationName); userprofile.Keywords.Remove(temp); s.UserProfiles.Remove(userprofile); } } } int i = 0; foreach (var item in userprofile.Specializations) { bool toadd = true; if (userprofile.Keywords == null) { userprofile.Keywords = new List<Keyword>(); } for (int j = 0; j < userprofile.Keywords.Count(); j++) { if (userprofile.Keywords.ElementAt(j).Area == userprofile.Specializations.ElementAt(i).SpecializationName) { toadd = false; } } if (toadd == true) { userprofile.Keywords.Add(new Keyword { Area = userprofile.Specializations.ElementAt(i).SpecializationName }); } i++; } } }
public ActionResult UpdateKeywords(string keywordlist) { string myname = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == myname); int count = myprofile.Keywords.Count(); for (int i = 0; i < count; i++) { Keyword temp = myprofile.Keywords.ElementAt(0); myprofile.Keywords.Remove(temp); followPeersDB.Keywords.Remove(temp); } char[] delimiterChars = { ',' }; string[] words = keywordlist.Split(delimiterChars); foreach (string s in words) { string s2 = s.Trim(); Keyword temp = new Keyword { Area = s2 }; myprofile.Keywords.Add(temp); } followPeersDB.Entry(myprofile).State = EntityState.Modified; followPeersDB.SaveChanges(); return RedirectToAction("Index", "News", new { reader = "Yahoo" }); }
public ActionResult BookmarkPublication() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); int numberOfBookmarks = myprofile.PublicationBookmark.Count(); List<int> bookmarkID = myprofile.PublicationBookmark.ToList(); ViewBag.infopresent = false; if (numberOfBookmarks == 1) { var result = from n in followPeersDB.PublicationModels where n.publicationID.Equals(bookmarkID[0]) orderby n.title select n; ViewBag.infopresent = true; return PartialView(result.ToList()); } if (numberOfBookmarks == 2) { var result = from n in followPeersDB.PublicationModels where (n.publicationID.Equals(bookmarkID[0]) || n.publicationID.Equals(bookmarkID[1])) orderby n.title select n; ViewBag.infopresent = true; return PartialView(result.ToList()); } if (numberOfBookmarks == 3) { var result = from n in followPeersDB.PublicationModels where (n.publicationID.Equals(bookmarkID[0]) || n.publicationID.Equals(bookmarkID[1]) || n.publicationID.Equals(bookmarkID[2])) orderby n.title select n; ViewBag.infopresent = true; return PartialView(result.ToList()); } if (numberOfBookmarks == 4) { var result = from n in followPeersDB.PublicationModels where (n.publicationID.Equals(bookmarkID[0]) || n.publicationID.Equals(bookmarkID[1]) || n.publicationID.Equals(bookmarkID[2]) || n.publicationID.Equals(bookmarkID[3])) orderby n.title select n; ViewBag.infopresent = true; return PartialView(result.ToList()); } if (numberOfBookmarks == 5) { var result = from n in followPeersDB.PublicationModels where (n.publicationID.Equals(bookmarkID[0]) || n.publicationID.Equals(bookmarkID[1]) || n.publicationID.Equals(bookmarkID[2]) || n.publicationID.Equals(bookmarkID[3]) || n.publicationID.Equals(bookmarkID[4])) orderby n.title select n; ViewBag.infopresent = true; return PartialView(result.ToList()); } return PartialView(); }
public ActionResult UploadPhoto() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); return View(myprofile); }
public ActionResult DeleteGroup(string name) { string myname = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == myname); Group grp = followPeersDB.Groups.SingleOrDefault(p => p.Name == name & p.OwnerId == myprofile.UserProfileId); followPeersDB.Groups.Remove(grp); followPeersDB.SaveChanges(); return RedirectToAction("Index", "Bulletin", new { sort = 3 }); }
public ActionResult ViewBookmarkJobs() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); List<Job> result = myprofile.Jobs.ToList(); List<Job> tempresult = myprofile.Jobs.ToList(); foreach (var j in tempresult) { if (j.ownerId == myprofile.UserProfileId) { result.Remove(j); } } return View(result); }
public ActionResult EditStudents(string message) { if (message != null) ViewData["message"] = message; string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); return View(myprofile); }
public void Bookmark(string jobid, string url) { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); int jobidINT = Convert.ToInt16(jobid); // UserProfile followerProfile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username); // UserProfile followerProfile = new UserProfile(); Job job = followPeersDB.Jobs.SingleOrDefault(p => p.JobId == jobidINT); myprofile.Jobs.Add(job); followPeersDB.SaveChanges(); UserProfile updateowner = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserProfileId == job.ownerId); string jobdescription = job.Description; if (jobdescription.Length > 60) jobdescription = job.Description.Substring(0, 60) + "..."; Notification newnoti = new Notification { message = myprofile.FirstName + " bookmarked your job post : " + jobdescription, link = "/Profile/Index/" + myprofile.UserProfileId, New = true, imagelink = myprofile.PhotoUrl, }; updateowner.Notifications.Add(newnoti); followPeersDB.Entry(updateowner).State = EntityState.Modified; followPeersDB.SaveChanges(); Response.Redirect(url); // return RedirectToAction("Index", "Profile", new { id = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == username).UserProfileId }); }
public string GetNotifications() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); string returnstring = ""; int i = 0; var notificationslist = myprofile.Notifications.OrderByDescending(x => x.NotificationID); foreach (var noti in notificationslist) { if (i == 5) break; string msg = noti.message; if (noti.message.Length > 75) msg = noti.message.Substring(0, 70) + "..."; returnstring += "<div class='each_rec'><div style='height: 50px;overflow: hidden;float: left;'><img src='" + noti.imagelink + "' style='width:50px;'></div><div style='float: left;width: 70%;text-align:left;'><a href='" + noti.link + "' style='height: 50px;line-height: 14px;width: 100%;font-weight: normal;'>" + msg + "</a></div><div style='clear: both;'></div></div>"; i++; } if (myprofile.Notifications.Count() == 0) { returnstring += "<div class='each_rec'><div style='float: left;width: 95%;'><a href='#' style='height: 25px;line-height: 14px;width: 100%;font-weight: normal;'>You have no notifications.</a></div><div style='clear: both;'></div></div>"; } if (notificationslist.Count() != 0) returnstring += "<div class='each_rec'><div style='float: left;width: 95%;'><a href='../../Profile/ViewMoreNotifications' style='height: 25px;line-height: 14px;width: 100%;font-weight: normal;'> View More Notifications </a></div><div style='clear: both;'></div></div>"; return returnstring; }
public ActionResult ViewBookmarkPublications() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); IEnumerable<Bookmark> result = from b in followPeersDB.Bookmarks where (b.userID == myprofile.UserProfileId && b.bookmarkType == "Publication") select b; List<PublicationModel> tempresult = new List<PublicationModel>(); foreach (var b in result) { PublicationModel temppublication = followPeersDB.PublicationModels.SingleOrDefault(p => p.publicationID == b.itemID); tempresult.Add(temppublication); } return View(tempresult); }
public ActionResult Index(int id) { string name = Membership.GetUser().UserName; UserProfile viewerprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserProfileId == id); myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); if (myprofile == null) //if the database stores a wrong info about name { name = " " + name; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); myprofile.UserName.Trim(); followPeersDB.SaveChanges(); } if (viewerprofile.firsttime == true) { return RedirectToAction("Edit", "Profile", new { id = viewerprofile.UserProfileId }); } else { ViewBag.Name = viewerprofile.UserName; if ((followPeersDB.Relationships.SingleOrDefault(p => p.personAName == name && p.personBName == viewerprofile.UserName) != null))//already followed ViewBag.Alreadyfollowed = 1; else ViewBag.Alreadyfollowed = 0; return View(viewerprofile); } }
public ActionResult ViewMoreNotifications() { string name = Membership.GetUser().UserName; myprofile = followPeersDB.UserProfiles.SingleOrDefault(p => p.UserName == name); var result = myprofile.Notifications.OrderByDescending(x => x.NotificationID); return View(result); }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus; //changed from model.UserName to model.Email of parameter 1 Membership.CreateUser(model.Email, model.Password, model.Email, "question", "answer", true, null, out createStatus); if (createStatus == MembershipCreateStatus.Success) { FormsAuthentication.SetAuthCookie(model.Email, false /* createPersistentCookie */); string authorizationCode = CalculateMD5Hash(model.Email + "followpeers"); string messagetosend = "<a href='http://*****:*****@isp.c0m", "*****@*****.**", "Testing", messagetosend); SmtpClient smtpClient = new SmtpClient(); smtpClient.UseDefaultCredentials = false; smtpClient.Host = "smtp.gmail.com"; smtpClient.Port = 587; smtpClient.Credentials = new NetworkCredential("*****@*****.**", "followpeers123!"); smtpClient.EnableSsl = true; smtpClient.Send(message); * */ //System.Data.Entity.Database.SetInitializer(new SampleData()); CultureInfo provider = CultureInfo.InvariantCulture; UserProfile myprofile = new UserProfile { UserName = model.Email.Trim(), FirstName = model.FirstName, LastName = model.LastName, Profession = model.Profession, activated = true, firsttime = true, Default = 2, PhotoUrl = "/Content/TempImages/default.jpg", Specializations = new List<Specialization>(), Tiers = new List<Tier>(), Keywords = new List<Keyword>(), Contact = new Contact() }; //myprofile.UserName = model.Email; // myprofile.UserName.Replace(" ", string.Empty); myprofile.UserName.Trim(); myprofile.Tiers.Add(new Tier { Level = 1, Email = 1, Phone = 0, Mobile = 0, Address = 0, Education = 1, Publication = 1, Patent = 1, Noticeboard = 0, AboutMe = 0 }); myprofile.Tiers.Add(new Tier { Level = 2, Email = 1, Phone = 1, Mobile = 0, Address = 0, Education = 1, Publication = 1, Patent = 1, Noticeboard = 1, AboutMe = 1 }); myprofile.Tiers.Add(new Tier { Level = 3, Email = 1, Phone = 1, Mobile = 1, Address = 1, Education = 1, Publication = 1, Patent = 1, Noticeboard = 1, AboutMe = 1 }); followPeersDB.UserProfiles.Add(myprofile); followPeersDB.SaveChanges(); return RedirectToAction("Index", "Profile", new { id = myprofile.UserProfileId }); //return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", ErrorCodeToString(createStatus)); } } // If we got this far, something failed, redisplay form return View(model); }
private void UpdateEducation(string[] Organization, string[] startYear, string[] endYear, string[] Degree, string[] Country, UserProfile userprofile) { //if new organization, add to the DB foreach (var org in Organization) { if ((followPeersDB.Organizations.SingleOrDefault(p => p.Name == org)) == null) { followPeersDB.Organizations.Add(new Organization { Name = org }); } } int count = userprofile.Educations.Count(); for (int i = 0; i < count; i++) { Education tempEdu = userprofile.Educations.ElementAt(0); followPeersDB.Educations.Remove(tempEdu); // userprofile.Educations.Remove(tempEdu); } for (int i = 0; i < Organization.Count(); i++) { if (Organization != null) { string tempUni = Organization.ElementAt(i); string tempStart = startYear.ElementAt(i); string tempEnd = endYear.ElementAt(i); string tempDegree = Degree.ElementAt(i); string tempCountry = Country.ElementAt(i); Education tempEdu = new Education { UniversityName = tempUni, startYear = Convert.ToInt16(tempStart), endYear = Convert.ToInt16(tempEnd), Degree = tempDegree, country = tempCountry }; userprofile.Educations.Add(tempEdu); tempEdu.UserProfile = userprofile; } } }