예제 #1
0
파일: Rate.cs 프로젝트: cymbidum/HITRating
        public bool Delete(int id, string userName)
        {
            try
            {
                var entity = RestfulRate.Read(id);

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

                return(RestfulRate.Delete(id));
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
파일: Rate.cs 프로젝트: cymbidum/HITRating
        public Models.Rate Read(int id, string userName = null)
        {
            try
            {
                var entity = RestfulRate.Read(id);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
파일: Rate.cs 프로젝트: cymbidum/HITRating
        public Models.Rate First(Models.RateSearchModel conditions = null, string userName = null)
        {
            try
            {
                var entity = RestfulRate.First(conditions);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
예제 #4
0
파일: Rate.cs 프로젝트: cymbidum/HITRating
        public Models.Rate Create(Models.Rate entity, string userName)
        {
            try
            {
                if (!RateAccessControl.Pass(RestfulAction.Create, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

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

                return(RestfulRate.Create(entity));
            }
            catch
            {
                throw;
            }
        }
예제 #5
0
파일: Rate.cs 프로젝트: cymbidum/HITRating
        public Models.Rate Update(int id, Models.Rate entity, string userName)
        {
            try
            {
                var old = RestfulRate.Read(id);

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

                entity.ReviewId    = old.ReviewId;
                entity.AspectId    = old.AspectId;
                entity.AspectTitle = old.AspectTitle;
                entity.Creator     = userName;
                entity.Created     = old.Created;

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