Ejemplo n.º 1
0
        public ModelResponse UpdateProfile(UserInfo user, ref OrgVm vm, string fileFolder)
        {
            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (string.IsNullOrWhiteSpace(user.UserId))
                {
                    return(new ModelResponse(101));
                }
                if (PUserRepo.GetUserClass(user) != UserClass.OrgAdmin)
                {
                    return(new ModelResponse(101));
                }

                //Validations
                var ret = ValidateOrgProfile(vm, fileFolder);
                if (ret != null)
                {
                    return(ret);
                }

                //Update DB
                vm.PortalUserId = (long)user.PortalUserId;
                vm.Approval     = Approval.Pending;
                Repo.UpdateProfile(ref vm, user.UserId);
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0, vm.PortalUserId));
        }