Ejemplo n.º 1
0
        /// <summary>
        /// Method to upload profile image
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public bool UploadProfileImage(Member member, string imagePath)
        {
            #region Business Logic

            bool updated = false;
            try
            {
                //see if member.MemberProfile is empty
                //if empty create new
                //if exists, update

                MemberProfile memberProfileData = repoObj.List<MemberProfile>(x => x.Member.id.Equals(member.id)).FirstOrDefault();

                if (memberProfileData == null)
                {
                    memberProfileData = new MemberProfile();
                    memberProfileData.id = Guid.NewGuid();
                    memberProfileData.memberId = member.id;
                    memberProfileData.imagePath = imagePath;
                    repoObj.Create<MemberProfile>(memberProfileData);
                }
                else
                {
                    memberProfileData.imagePath = imagePath;
                    repoObj.Update<MemberProfile>(memberProfileData);
                }
                updated = true;
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
            return updated;
            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method to Update Member profile.
        /// </summary>
        /// <param name="member"></param>
        /// <param name="sex"></param>
        /// <param name="dob"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool UpdateMemberProfile(Member member, string sex, DateTime dob, Location location, string url, string bio)
        {
            #region Business Logic

            bool updated = false;
            try
            {
                //see if member.MemberProfile is empty
                //if empty create new
                //if exists, update

                MemberProfile memberProfileData = repoObj.List<MemberProfile>(x => x.Member.id.Equals(member.id)).FirstOrDefault();

                if (memberProfileData == null)
                {
                    memberProfileData = new MemberProfile();
                    memberProfileData.id = Guid.NewGuid();
                    memberProfileData.locationId = location.id;
                    memberProfileData.memberId = member.id;
                    memberProfileData.sex = sex;
                    memberProfileData.setURL = url;
                    memberProfileData.bio = bio;
                    repoObj.Create<MemberProfile>(memberProfileData);
                }
                else
                {
                    memberProfileData.sex = sex;
                    memberProfileData.locationId = location.id;
                    memberProfileData.setURL = url;
                    memberProfileData.bio = bio;
                    repoObj.Update<MemberProfile>(memberProfileData);
                }
                updated = true;
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
            return updated;
            #endregion
        }