예제 #1
0
        public Models.Aspect First(Models.AspectSearchModel conditions = null, string userName = null)
        {
            try
            {
                var entity = RestfulAspect.First(conditions);

                if (!AspectAccessControl.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 = RestfulAspect.Read(id);

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

                return(RestfulAspect.Delete(id));
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
        public Models.Aspect Read(int id, string userName = null)
        {
            try
            {
                var entity = RestfulAspect.Read(id);

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

                return(entity);
            }
            catch
            {
                throw;
            }
        }
예제 #4
0
        public Models.Aspect Create(Models.Aspect entity, string userName)
        {
            try
            {
                if (!AspectAccessControl.Pass(RestfulAction.Create, entity, userName))
                {
                    throw new NoAccessException("No Access");
                }

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

                return(RestfulAspect.Create(entity));
            }
            catch
            {
                throw;
            }
        }
예제 #5
0
        public Models.Aspect Update(int id, Models.Aspect entity, string userName)
        {
            try
            {
                var old = RestfulAspect.Read(id);

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

                entity.CategoryId = old.CategoryId;
                entity.Title      = old.Title;
                entity.Creator    = userName;
                entity.Created    = old.Created;

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