public void Update(NoteKernel note) { var contextNote = note.ToEntity(); using (var uow = new UnitOfWork()) { uow.Notes.Update(contextNote); uow.SaveChanges(); } }
public NoteKernel Get(int noteID) { Note note; using (var uow = new UnitOfWork()) { note = uow.Notes.Get(noteID); } NoteKernel noteKernel = note?.ToKernel(); return((noteKernel?.IsAvailible() ?? false) ? noteKernel : null); }
public static Note ToEntity(this NoteKernel note) { if (note == null) { return(null); } return(new Note { Header = note.Header, Link = note.Link, Content = note.Content, AppearAt = note.AppearAt, ExpireAt = note.ExpireAt, }); }