public void AddPartyComment(NewPartiesComment comment, DateTime now) { using (var context = new DatabaseContext()) { var entity = context.PartiesComments.Create(); entity.Id = comment.Id; entity.CaseId = comment.CaseId; entity.Comment = comment.Text; entity.Date = now; foreach (var document in comment.Documents) { var documentEntity = context.Documents.Create(); documentEntity.Id = document.Id; documentEntity.Name = document.Name; context.Documents.Add(documentEntity); entity.Documents.Add(documentEntity); } context.PartiesComments.Add(entity); context.SaveChanges(); } }
public void AddPartiesComment(UserHeader user, NewPartiesComment newPartiesComment) { _database.AddPartyComment(newPartiesComment, DateTime.Now); foreach (var document in newPartiesComment.Documents) { _documentStore.Upload(document.Id, newPartiesComment.CaseId, new DocumentStoreItem { Name = document.Name, Content = document.Body, }); _database.AddDocumentActivity(new DocumentActivity { Id = Guid.NewGuid(), CaseId = newPartiesComment.CaseId, DocumentId = document.Id, DocumentName = document.Name, DocumentType = DocumentType.PartyComment, ActionType = ActionType.Create, UserId = user.Id, Date = DateTime.Now }); } }