public Note Create(Note note) { validator.Validate(note); note.Bucket = Bucket.OneDay; return notesRepository.Create(note); }
public Note Create(Note note) { return Execute<Note>(() => { note.NoteID = conn.Query<int>(@"INSERT note (CategoryID, Title, Description, BucketID) VALUES (@CategoryID, @Title, @Description, @BucketID); SELECT CAST(SCOPE_IDENTITY() as int);", new { CategoryID = note.CategoryID, Title = note.Title, Description = note.Description, BucketID = note.Bucket }).Single(); return note; }); }
public void Update(Note note) { if (note.NoteID == 0) throw new Exception("NoteID is not set."); Execute(() => { conn.Execute(@"UPDATE note set Title=@Title, CategoryID=@CategoryID, Description=@Description, BucketID = @BucketID WHERE noteID=@NoteID", new { NoteID = note.NoteID, CategoryID = note.CategoryID, Title = note.Title, Description = note.Description, BucketID = note.Bucket }); }); }
public void Update(Note note) { notesRepository.Update(note); }
public int Create(Note note) { return notesRepository.Create(note).NoteID; }
public void Update(Note note) { validator.Validate(note); notesRepository.Update(note); }