Beispiel #1
0
        public ModelResponse GetOrgContact(UserInfo user, long contactId)
        {
            OrgContactVm r;

            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (string.IsNullOrWhiteSpace(user.UserId))
                {
                    return(new ModelResponse(101));
                }
                if (user.PortalUserId < 1)
                {
                    return(new ModelResponse(101));
                }

                //Load from DB
                if (user.OrgContactId == contactId || DalFactory.Singleton.DataService.IsAdmin(user.UserId))
                {
                    r = Repo.GetOrgContact(contactId);
                }
                else
                {
                    r = Repo.GetOrgContact(contactId, (long)user.PortalUserId);
                }
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0, r));
        }