Пример #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);
        }