Exemple #1
0
        public ProfileResultModel GetProfile()
        {
            ProfileResultModel result = new ProfileResultModel();

            try
            {
                int?memberId = IdentityHelper.GetMemberId();
                if (!memberId.HasValue)
                {
                    throw new OrgException("Invalid MemberId");
                }

                MemberBL bl = new MemberBL();

                var memberList = bl.GetMemberByCriteria(memberId.Value.ToString(), MemberBL.ExistCriteriaType.Id);

                if (memberList.Count == 0)
                {
                    throw new OrgException("Invalid profile");
                }

                result.Status  = true;
                result.Member  = memberList[0].Value;
                result.Message = "Get profile successfully";
            }
            catch (OrgException oex)
            {
                result.Status  = false;
                result.Message = oex.Message;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = AppConfigs.InternalErrorMessage;

                if (AppConfigs.DebugInternalMessage)
                {
                    result.InternalMessage = ex.Message;
                }
            }

            return(result);
        }
Exemple #2
0
        public ExistResultModel CheckIfMemberExistsByPhone(string phoneNo)
        {
            ExistResultModel result = new ExistResultModel();

            try
            {
                MemberBL bl = new MemberBL();

                var memberByEmail = bl.GetMemberByCriteria(phoneNo, MemberBL.ExistCriteriaType.PhoneNo);

                result.Items = memberByEmail.Select(r => new ExistModel
                {
                    Criteria = r.Key,
                    IsExists = (r.Value != null),
                    Id       = (r.Value == null) ? null : (int?)r.Value.Id
                }).ToList();

                result.Status  = true;
                result.Message = "Checked";
            }
            catch (OrgException oex)
            {
                result.Status  = false;
                result.Message = oex.Message;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = AppConfigs.InternalErrorMessage;

                if (AppConfigs.DebugInternalMessage)
                {
                    result.InternalMessage = ex.Message;
                }
            }

            return(result);
        }