public async Task InsertToRequestAsync(int id, int documentId)
        {
            var docu = await documentRepo.GetFirstOrDefaultAsync(predicate : c => c.NewAffiliationId == id);

            var HistoryGroupId = Guid.NewGuid();
            var document       = new DocumentChecklist {
                NewAffiliationId = id,
                documentName     = documentId,
                AuditLogGroupId  = docu.AuditLogGroupId,
                HistoryGroupId   = HistoryGroupId
            };
            await historyRepo.InsertAsync(new History {
                date            = DateTime.Now,
                action          = "Document: " + id + " Added", //documentChecklist.documentName
                groupCode       = role,
                user            = user,
                RequestId       = docu.NewAffiliationId,
                AuditLogGroupId = docu.AuditLogGroupId,
                HistoryGroupId  = HistoryGroupId
            });



            await documentRepo.InsertAsync(document);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateDocumentChecklist([FromBody] DocumentChecklist document)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await documentChecklistService.InsertAsync(document);

            await documentChecklistService.SaveChangesAsync();

            return(Ok(document));
        }
        public async Task Delete(DocumentChecklist documentChecklist)
        {
            // DocumentChecklist.NewAffiliationId is the same with Request.Id
            documentChecklist.HistoryGroupId = Guid.NewGuid();
            await historyRepo.InsertAsync(new History {
                date            = DateTime.Now,
                action          = "Document: " + documentChecklist.documentName + " Deleted",
                groupCode       = role,
                user            = user,
                RequestId       = documentChecklist.NewAffiliationId,
                AuditLogGroupId = documentChecklist.AuditLogGroupId,
                HistoryGroupId  = documentChecklist.HistoryGroupId
            });

            documentRepo.Delete(documentChecklist);
        }
 public async Task InsertAsync(DocumentChecklist documentChecklist)
 {
     await documentRepo.InsertAsync(documentChecklist);
 }