Пример #1
0
        public Models.Review First(Models.ReviewSearchModel conditions = null, string userName = null)
        {
            try
            {
                var entity = RestfulReview.First(conditions);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        public bool Delete(int id, string userName)
        {
            try
            {
                var entity = RestfulReview.Read(id);

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

                return(RestfulReview.Delete(id));
            }
            catch
            {
                throw;
            }
        }
Пример #3
0
        public Models.Review Read(int id, string userName = null)
        {
            try
            {
                var entity = RestfulReview.Read(id);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
Пример #4
0
        public Models.Review Create(Models.Review entity, string userName)
        {
            try
            {
                if (!ReviewAccessControl.Pass(RestfulAction.Create, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

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

                return(RestfulReview.Create(entity));
            }
            catch
            {
                throw;
            }
        }
Пример #5
0
        public Models.Review Update(int id, Models.Review entity, string userName)
        {
            try
            {
                var old = RestfulReview.Read(id);

                if (!ReviewAccessControl.Pass(RestfulAction.Update, old, userName))
                {
                    throw new NoAccessException("No Access");
                }

                entity.ProductId = old.ProductId;
                entity.Creator   = userName;
                entity.Created   = old.Created;
                entity.Updated   = DateTime.Now;

                return(RestfulReview.Update(id, entity));
            }
            catch
            {
                throw;
            }
        }