public NoteCreationInfo Create(NoteBuildInfo buildInfo) { if (buildInfo == null) { throw new ArgumentNullException(nameof(buildInfo)); } var utcNow = DateTime.UtcNow; var id = Guid.NewGuid(); var note = new Note { Id = id, Title = buildInfo.Title, Text = buildInfo.Text, Favorite = false, CreatedAt = utcNow, UpdatedAt = utcNow, }; this.notes.Add(note); var noteCreationInfo = new NoteCreationInfo { Id = id, CreatedAt = utcNow, }; return(noteCreationInfo); }
public static View.NoteCreationInfo Convert(Model.NoteCreationInfo modelNoteCreationInfo) { if (modelNoteCreationInfo == null) { throw new ArgumentNullException(nameof(modelNoteCreationInfo)); } var viewNoteCreationInfo = new View.NoteCreationInfo { Id = modelNoteCreationInfo.Id.ToString(), CreatedAt = modelNoteCreationInfo.CreatedAt, }; return(viewNoteCreationInfo); }