Beispiel #1
0
        public Models.Vote First(Models.VoteSearchModel conditions = null, string userName = null)
        {
            try
            {
                var entity = RestfulVote.First(conditions);

                if (!VoteAccessControl.Pass(RestfulAction.Read, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

                return(entity);
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
        public Models.Vote Read(int id, string userName = null)
        {
            try
            {
                var entity = RestfulVote.Read(id);

                if (!VoteAccessControl.Pass(RestfulAction.Read, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

                return(entity);
            }
            catch
            {
                throw;
            }
        }
Beispiel #3
0
        public bool Delete(int id, string userName)
        {
            try
            {
                var entity = RestfulVote.Read(id);

                if (!VoteAccessControl.Pass(RestfulAction.Delete, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

                return(RestfulVote.Delete(id));
            }
            catch
            {
                throw;
            }
        }
Beispiel #4
0
        public Models.Vote Create(Models.Vote entity, string userName)
        {
            try
            {
                if (!VoteAccessControl.Pass(RestfulAction.Create, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

                entity.Creator = userName;
                entity.Created = DateTime.Now;

                return(RestfulVote.Create(entity));
            }
            catch
            {
                throw;
            }
        }