Ejemplo n.º 1
0
        //list friends

        public List<PersonalDetails> getListOfFriends(string searchFriends, int? id)
        {
            var friendsList = from f in db.PersonalInfoes
                              where f.UserInfoID != id && (f.firstName.ToLower().Contains(searchFriends.ToLower()) ||
                              f.lastName.ToLower().Contains(searchFriends.ToLower()))
                              select f;

            if (!String.IsNullOrEmpty(searchFriends))
            {

                friendsList = friendsList.Take(10);
                friendsList = friendsList.OrderByDescending(f => f.firstName);
            }
            foreach (PersonalDetails pdet in friendsList)
            {
                PersonalDetails person = new PersonalDetails();
                person.ID = pdet.ID;
                person.firstName = pdet.firstName;
                person.lastName = pdet.lastName;
                person.contactNumber = pdet.contactNumber;
                person.profession = pdet.profession;
                person.currentCity = pdet.currentCity;
                person.currentCountry = pdet.currentCountry;
                person.dateOfBirth = pdet.dateOfBirth;
                person.imageUrl = pdet.imageUrl;
                person.UserInfoID = pdet.UserInfoID;
                suggestedFriendsList.Add(person);
            }
            if (suggestedFriendsList == null)
            {
                return null;
            }
            return suggestedFriendsList;
        }
Ejemplo n.º 2
0
        public void AddPersonalInfo(PersonalDetailsModel PersonalDetailsModelClient)
        {
            var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());
            int id = currentUser.UserInfo.Id;

            PersonalDetails pd = new PersonalDetails();
            pd.firstName = PersonalDetailsModelClient.firstName;
            pd.lastName = PersonalDetailsModelClient.lastName;
            pd.profession = PersonalDetailsModelClient.profession;
            pd.contactNumber = PersonalDetailsModelClient.contactNumber;
            pd.currentCity = PersonalDetailsModelClient.currentCity;
            pd.currentCountry = PersonalDetailsModelClient.currentCountry;
            pd.dateOfBirth = Convert.ToDateTime(PersonalDetailsModelClient.dateOfBirth);
            pd.imageUrl = PersonalDetailsModelClient.imageUrl;
            pd.UserInfoID = id;
            PersonalDetailsBusinessLayer pdBal = new PersonalDetailsBusinessLayer();
            pdBal.InsertPersonalDetails(pd);
        }
Ejemplo n.º 3
0
 public void UpdatePersonalInfo(PersonalDetails PersonalDetailsModelClient)
 {
     PersonalDetailsBusinessLayer pdBal = new PersonalDetailsBusinessLayer();
     pdBal.UpdatePersonalDetails(PersonalDetailsModelClient);
 }
Ejemplo n.º 4
0
 public void UpdatePersonalDetails([Bind(Include = "ID,firstName,lastName,contactNumber,profession,currentCity,currentCountry,dateOfBirth,imageUrl")] PersonalDetails personalDetails)
 {
     db.Entry(personalDetails).State = EntityState.Modified;
     db.Entry(personalDetails).Property("UserInfoID").IsModified = false;
     db.SaveChanges();
 }
Ejemplo n.º 5
0
 public void InsertPersonalDetails([Bind(Include = "ID,firstName,lastName,contactNumber,profession,currentCity,currentCountry,dateOfBirth,imageUrl,UserInfoID")] PersonalDetails personalDetails)
 {
     db.PersonalInfoes.Add(personalDetails);
     db.SaveChanges();
 }