Example #1
0
        public void DeleteCase(Task task)
        {
            Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> Processing DeleteCase.");
            var prfMonMethod = new PrfMon();

            var library = _libraryRepository.Single(x => x.CaseId == task.CaseId.Value);

            using (var context = new ClientContext(SiteCollectionUrl(library.Site.ProvisionedSite.ProvisionedSiteCollection.Name)))
            {
                var web = _contextService.Load(context, Credentials);

                Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> DeleteDocumentLibrary. Started.");
                var deleteDocumentLibraryPrfMonTriggers = new PrfMon();
                var spSite = web.Webs.Single(x => x.Url == library.Site.Url);
                var documentLibraryList = spSite.Lists.GetById(library.ListId);
                context.Load(documentLibraryList);
                documentLibraryList.DeleteObject();
                context.ExecuteQuery();
                Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> DeleteDocumentLibrary. Completed. Average Execution: {0:0.000}s", deleteDocumentLibraryPrfMonTriggers.Stop());

                _contextService.Audit(context, task, string.Format(TaskResources.Audit_DeleteCase, library.Site.Pin, library.CaseId, library.Title));

                Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> DatabaseSynchronisation. Started.");
                var databaseSynchronisationPrfMonTriggers = new PrfMon();
                _libraryService.Delete(library);
                Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> DatabaseSynchronisation. Completed. Average Execution: {0:0.000}s", databaseSynchronisationPrfMonTriggers.Stop());
            }

            Debug.WriteLine("Fujitsu.AFC.Services.CaseService.cs -> Completed Processing DeleteCase. Duration: {0:0.000}s", prfMonMethod.Stop());
        }
        public IHttpActionResult DeleteLibrary(int id)
        {
            var result = libraryService.Delete(id);

            if (result)
            {
                return(Content(HttpStatusCode.OK, "success"));
            }

            return(Content(HttpStatusCode.BadRequest, "Deleting Failed"));
        }
        public async Task <IActionResult> Delete(int id)
        {
            Library library = await _libraryService.Get(id);

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

            await _libraryService.Delete(library);

            return(Ok());
        }
        public void LibraryService_Delete_ByEntity_CallsDeleteAndUnitOfWorkSave()
        {
            #region Arrange

            var library = new Library
            {
                Id = 1
            };

            #endregion

            #region Act

            _libraryService.Delete(library);

            #endregion

            #region Assert

            _mockLibraryRepository.Verify(x => x.Delete(It.IsAny <Library>()), Times.Once());
            _mockUnitOfWork.Verify(x => x.Save(), Times.Once);

            #endregion
        }
Example #5
0
 public void DeleteLibraryItem(ulong libraryId)
 {
     _libraryService.Delete(libraryId);
 }