Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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;
            }
        }