Beispiel #1
0
        public ModelResponse Approve(UserInfo user, long reqKey, long partnerId, bool approved, string reason)
        {
            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (!DalFactory.Singleton.DataService.IsAdmin(user.UserId))
                {
                    return(new ModelResponse(101));
                }
                if (!DalFactory.Singleton.DataService.IsSuperAdmin(user.UserId))
                {
                    if (DalFactory.Singleton.RequestLog.AssignedTo(reqKey) != user.UserId)
                    {
                        return(new ModelResponse(101));
                    }
                }

                _repo.Approve(user.UserId, reqKey, partnerId, approved, reason);
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0));
        }