Esempio n. 1
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            var catalog = await _catalogService.FindAsync(id.Value);

            await _catalogService.DeleteAsync(catalog);

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <ActionResult> Delete(string id)
        {
            //TODO
            //var catalog = (await _catalogService.GetByIdsAsync(new [] { id})).FirstOrDefault();
            //CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, catalog);

            await _catalogService.DeleteAsync(new[] { id });

            return(NoContent());
        }
        public async Task <ActionResult> DeleteCatalog(string id)
        {
            var catalog             = (await _catalogService.GetByIdsAsync(new [] { id })).FirstOrDefault();
            var authorizationResult = await _authorizationService.AuthorizeAsync(User, catalog, new CatalogAuthorizationRequirement(ModuleConstants.Security.Permissions.Delete));

            if (!authorizationResult.Succeeded)
            {
                return(Unauthorized());
            }

            await _catalogService.DeleteAsync(new[] { id });

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <ActionResult> DeleteAsync(string id, string authentication)
        {
            bool check = await _authentication.IsLoginAsync(authentication);

            if (check)
            {
                var result = await _service.DeleteAsync(id);

                if (!result)
                {
                    return(NotFound());
                }

                return(NoContent());
            }
            return(BadRequest("Not Loggin"));
        }