public static ProfileModel getProfileFromSession()
 {
     ProfileModel model = new ProfileModel();
     model.firstName = System.Web.HttpContext.Current.Session["firstName"].ToString();
     model.lastName = System.Web.HttpContext.Current.Session["lastName"].ToString();
     model.email = System.Web.HttpContext.Current.Session["email"].ToString();
     model.id = int.Parse(System.Web.HttpContext.Current.Session["id"].ToString());
     model.gender = System.Web.HttpContext.Current.Session["gender"].ToString();
     model.dob = Convert.ToDateTime(System.Web.HttpContext.Current.Session["dob"].ToString());
     return model;
 }
 public static ProfileModel getUserDataFromCookie()
 {
     FormsAuthenticationTicket forms = FormsAuthentication.Decrypt(System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName].Value);
     ProfileModel model = new ProfileModel();
     String userData = forms.UserData;
     String[] userArray = userData.Split('|');
     model.email = forms.Name;
     model.firstName = userArray[0];
     model.lastName = userArray[1];
     model.id = int.Parse(userArray[2]);
     model.dob = Convert.ToDateTime(userArray[3]);
     model.gender = userArray[4];
     return model;
 }
 public static ProfileModel getProfile(String email)
 {
     SIEBUEntities context = new SIEBUEntities();
     if (context.Users.Where(u => u.email == email).Count() != 0)
     {
         User user = context.Users.First(c => c.email == email); // Must check if user is in the database
         ProfileModel model = new ProfileModel();
         model.id = user.id;
         model.email = email;
         model.firstName = user.firstName;
         model.lastName = user.lastName;
         model.dob = user.dob;
         model.gender = Convert.ToInt32(user.gender).ToString();
         model.about = user.about;
         model.profile_image = user.profileimg_url;
         model.location = user.location;
         model.contact_email = (user.User_Contact.Count(c => c.Contact.caption == "Email Address") > 0 ? user.User_Contact.Where(c => c.Contact.caption == "Email Address").FirstOrDefault().value : "");
         model.website = (user.User_Contact.Count(c => c.Contact.caption == "Website") > 0 ? user.User_Contact.Where(c => c.Contact.caption == "Website").FirstOrDefault().value : "");
         model.social_media = SocialMediaModel.getSocialMedia(user, context);
         return model;
     }
     return null;
 }