Esempio n. 1
0
        public CopyResult Copy(int id)
        {
            var result = new CopyResult();
            var group  = UserGroupRepository.GetPropertiesById(id);

            if (group == null)
            {
                throw new ApplicationException(string.Format(UserGroupStrings.GroupNotFound, id));
            }

            group.MutateName();
            var newId = UserGroupRepository.CopyGroup(group, QPContext.CurrentUserId);

            if (newId == 0)
            {
                result.Message = MessageResult.Error(UserGroupStrings.GroupHasNotBeenCreated);
            }
            else
            {
                result.Id = newId;
            }
            return(result);
        }