public DeleteDocumentViewModel FindDocumentDelete(int id, CreateDocumentType dt) { var document = db.Documents.Find(id); int parentId = -1; switch (dt) { case CreateDocumentType.Course: parentId = document.Course.Id; break; case CreateDocumentType.Module: parentId = document.Module.Id; break; case CreateDocumentType.Activity: parentId = document.Activity.Id; break; } DeleteDocumentViewModel ddvm = new DeleteDocumentViewModel { Id = id, Name = document.Name, DocumentType = dt, ParentId = parentId }; return(ddvm); }
public WhenDocumentTypeCreatedTests() { _guid = Guid.NewGuid(); _helper = new EventSourceHelper(new List <IEvent>()); var command = new CreateDocumentType(_guid, "a new document type"); var handlers = new DocumentTypeCommandHandlers(_helper.Session); handlers.Handle(command); }