示例#1
0
        public Note Create(Note note)
        {
            validator.Validate(note);

            note.Bucket = Bucket.OneDay;
            return notesRepository.Create(note);
        }
示例#2
0
 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;
         });
 }
示例#3
0
        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 });
            });
        }
示例#4
0
 public void Update(Note note)
 {
     notesRepository.Update(note);
 }
示例#5
0
 public int Create(Note note)
 {
     return notesRepository.Create(note).NoteID;
 }
示例#6
0
        public void Update(Note note)
        {
            validator.Validate(note);

            notesRepository.Update(note);
        }