Ejemplo n.º 1
0
        public virtual async Task<IActionResult> Up(int id)
        {
            int? categoryId = await materialsManager.GetCategoryIdAsync(id);
            if (!categoryId.HasValue)
                return BadRequest();

            if (materialsAuthorization.CanChangeOrder(User.Roles, categoryId.Value))
                return Unauthorized();

            await materialsManager.UpAsync(id);

            contentCache.InvalidateCache(categoryId.Value);

            return Ok();
        }
Ejemplo n.º 2
0
        public virtual async Task <IActionResult> MaterialUp(int id)
        {
            int?categoryId = await materialsManager.GetMaterialCategoryIdAsync(id);

            if (!categoryId.HasValue)
            {
                return(BadRequest());
            }

            if (materialsAuthorization.CanChangeOrder(User.Roles, categoryId.Value))
            {
                return(Unauthorized());
            }

            var result = await materialsManager.MaterialUpAsync(id);

            if (result.Failed)
            {
                return(BadRequest());
            }

            return(Ok());
        }