public void Add(AccountNoteEntry accountNoteEntry) { using (var context = _contextFactory.Invoke()) { context.Save(accountNoteEntry); } }
public NoteModel(AccountNoteEntry accountNoteEntry) { // Initialize properties of base class dynamically foreach (var prop in typeof(AccountNoteEntry).GetProperties()) { GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(accountNoteEntry, null), null); } }
private void AddNote(AccountManagementModel accountManagementModel, NoteType noteType, string noteContent) { var accountNoteEntry = new AccountNoteEntry { AccountId = accountManagementModel.Id, WriterAccountId = new Guid(AuthSession.UserAuthId), WriterAccountEmail = AuthSession.UserAuthName, Type = noteType, CreationDate = DateTime.Now, Note = noteContent }; _accountNoteService.Add(accountNoteEntry); if (accountManagementModel.Notes == null) { accountManagementModel.Notes = new List <NoteModel>(); } accountManagementModel.Notes.Insert(0, new NoteModel(accountNoteEntry)); }