Esempio n. 1
0
        private void CheckGridItem(Item grid)
        {
            if (!userDb.ItemAllowed(User.Identity.Name, grid))
            {
                throw HttpExceptionFactory.Forbidden();
            }

            if (!ModelState.IsValid)
            {
                throw HttpExceptionFactory.InvalidModel();
            }

            if (!db.IsCorrectSlug(grid.slug, grid.id))
            {
                throw HttpExceptionFactory.BadSlug();
            }
        }
Esempio n. 2
0
        public void Update(PartialGrid grid)
        {
            if (!userDb.GridAllowed(User.Identity.Name, grid.Id))
            {
                throw HttpExceptionFactory.Forbidden();
            }

            if (!ModelState.IsValid)
            {
                throw HttpExceptionFactory.InvalidModel();
            }

            if (!db.IsCorrectSlug(grid.Slug, grid.Id))
            {
                throw HttpExceptionFactory.BadSlug();
            }

            if (db.Exsist(grid.Id))
            {
                db.Update(grid);
            }
        }