示例#1
0
        public async Task <Note> UpsertNote(Note note)
        {
            var insertCallback =
                timelineDataService.Callback($"Created Note {note.name}", Constants.TimelineReferences.Note);

            var updateCallback =
                timelineDataService.Callback($"Edited Note {note.name}", Constants.TimelineReferences.Note);

            return(await Upsert(CreateNoteSql, UpdateNoteSql, GetNoteSql, note, insertCallback, updateCallback));
        }
示例#2
0
        public async Task <Checklist> UpsertChecklist(Checklist checklist)
        {
            var instertSql = "insert into checklists(name, type, description, created_at, updated_at) values " +
                             "(@name, @type, @description, current_timestamp, current_timestamp) returning id";
            var updateSql = "update checklists set name=@name, type=@type, description=@description, " +
                            "updated_at=current_timestamp where id=@id";
            var selectSql = "select * from checklists where id=@id";
            var insert    = tds.Callback($"Created Checklist {checklist.name}", Constants.TimelineReferences.Checklist);
            var update    = tds.Callback($"Edited Checklist {checklist.name}", Constants.TimelineReferences.Checklist);

            return(await Upsert(instertSql, updateSql, selectSql, checklist, insert, update));
        }