Example #1
0
        public async Task <IActionResult> DeleteFile(int id)
        {
            var fileToDelete = await _repo.GetFile(id);

            if (fileToDelete == null)
            {
                return(NotFound());
            }

            if (!string.IsNullOrEmpty(fileToDelete.StorageId))
            {
                CloudBlockBlob blob = azureContainer.GetBlockBlobReference(fileToDelete.StorageId);
                if (await _repo.Delete(fileToDelete))
                {
                    await blob.DeleteIfExistsAsync();

                    return(Ok());
                }
            }
            else
            {
                if (await _repo.Delete(fileToDelete))
                {
                    return(Ok());
                }
            }
            throw new Exception($"Could not delete File {id}");
        }
        public async Task <IActionResult> DeleteFMAdmin(int id)
        {
            var fmAdminToDelete = await _repo.GetFMAdmin(id);

            if (fmAdminToDelete == null)
            {
                return(NotFound());
            }

            if (await _repo.Delete(fmAdminToDelete))
            {
                return(Ok());
            }

            throw new Exception($"File Manager Admin {id} failed on Delete");
        }
        public async Task <IActionResult> DeleteRole(int id)
        {
            var roleToDelete = await _repo.GetRole(id);

            if (roleToDelete == null)
            {
                return(NotFound());
            }

            if (await _repo.Delete(roleToDelete))
            {
                return(Ok());
            }

            throw new Exception($"Role {id} failed on Delete");
        }
        public async Task <IActionResult> DeleteCompany(int id)
        {
            var companyToDelete = await _repo.GetCompany(id);

            if (companyToDelete == null)
            {
                return(NotFound());
            }

            if (await _repo.Delete(companyToDelete))
            {
                return(Ok());
            }

            throw new Exception($"Company {id} failed on Delete");
        }
Example #5
0
        public async Task <IActionResult> DeleteFile(int id)
        {
            var fileToDelete = await _repo.GetFile(id);

            if (fileToDelete == null)
            {
                return(NotFound());
            }

            if (await _repo.Delete(fileToDelete))
            {
                return(Ok());
            }

            throw new Exception($"Could not delete File {id}");
        }