Esempio n. 1
0
        public Models.Chapter.Chapter CreateChapter(Models.Chapter.Chapter chapter)
        {
            string sqlStoredProcedure = @"BookOfKnowledge.dbo.Chapter_Create";

            using (var _connection = new SqlConnection(_labsysConnectionString))
            {
                _connection.Query <Models.Book.Book>(sqlStoredProcedure,
                                                     new { Title = chapter.Title, Description = chapter.Description }, commandType: CommandType.StoredProcedure);
            }

            return(ListChapters().Find(x => x.Id == chapter.Id));
            //return newBookList.LastOrDefault();
        }
Esempio n. 2
0
        public Models.Chapter.Chapter UpdateChapter(int id, Models.Chapter.Chapter chapter)
        {
            string sqlStoredProcedure = @"BookOfKnowledge.dbo.Chapter_Update";

            if (FindChapterById(id) != null)
            {
                using (var _connection = new SqlConnection(_labsysConnectionString))
                {
                    _connection.Query <Models.Book.Book>(sqlStoredProcedure,
                                                         new { Id = chapter.Id, Title = chapter.Title, Description = chapter.Description }, commandType: CommandType.StoredProcedure);

                    return(ListChapters().Find(x => x.Id == id));
                }
            }
            else
            {
                throw new InvalidExpressionException("No Chapter with Id = " + chapter.Id + " was Found");
            }
        }
Esempio n. 3
0
 public Models.Chapter.Chapter UpdateChapter(int id, Models.Chapter.Chapter chapter)
 {
     return(_chapterRepository.UpdateChapter(id, chapter));
 }
Esempio n. 4
0
 public Models.Chapter.Chapter CreateChapter(Models.Chapter.Chapter chapter)
 {
     return(_chapterRepository.CreateChapter(chapter));
 }
Esempio n. 5
0
 public Models.Chapter.Chapter CreateChapter(Models.Chapter.Chapter chapter)
 {
     return(_chapterService.CreateChapter(chapter));
 }
Esempio n. 6
0
 public Models.Chapter.Chapter Put(int id, [FromBody] Models.Chapter.Chapter chapter)
 {
     return(new BookOfKnowledge.RestAPI.DataService.ChapterDataService().UpdateChapter(id, chapter));
 }
Esempio n. 7
0
 public Models.Chapter.Chapter Post([FromBody] Models.Chapter.Chapter chapter)
 {
     return(new BookOfKnowledge.RestAPI.DataService.ChapterDataService().CreateChapter(chapter));
 }