Ejemplo n.º 1
0
        public async Task <IActionResult> RestoreMaterial(Guid id)
        {
            await MaterialService.ChangeStatus(id, Enums.MaterialStatus.Published);

            var model = await MaterialService.GetMaterials(status : Enums.MaterialStatus.Deleted, page : 0);

            model.Materials.OrderByDescending(m => m.PublishingDate);

            return(Ok(model));
        }
        public async Task <IActionResult> RestoreMaterial(Guid id)
        {
            var material = await MaterialService.GetById(id);

            if (material.UserId == await UserService.GetUserIdByEmail(User.Identity.Name))
            {
                await MaterialService.ChangeStatus(id, Enums.MaterialStatus.Published);
            }

            return(RedirectToAction("PersonalAccount", "Home"));
        }
        public async Task <IActionResult> DeleteMaterial(Guid id)
        {
            var material = await MaterialService.GetById(id);

            if (material.UserId == await UserService.GetUserIdByEmail(User.Identity.Name))
            {
                await MaterialService.ChangeStatus(id, Enums.MaterialStatus.Deleted);
            }

            var educatorsMaterialsViewModel = await MaterialService.GetMaterials(
                searchText : null, auditory : Enums.Auditory.Common, theme : Enums.Theme.Common,
                type : Enums.Type.Common, status : material.Status, page : 0,
                userId : await UserService.GetUserIdByEmail(User.Identity.Name), sortType : Enums.SortType.AlphabetAsc);

            return(Json(educatorsMaterialsViewModel));
        }