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(); }
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"); } }
public Models.Chapter.Chapter UpdateChapter(int id, Models.Chapter.Chapter chapter) { return(_chapterRepository.UpdateChapter(id, chapter)); }
public Models.Chapter.Chapter CreateChapter(Models.Chapter.Chapter chapter) { return(_chapterRepository.CreateChapter(chapter)); }
public Models.Chapter.Chapter CreateChapter(Models.Chapter.Chapter chapter) { return(_chapterService.CreateChapter(chapter)); }
public Models.Chapter.Chapter Put(int id, [FromBody] Models.Chapter.Chapter chapter) { return(new BookOfKnowledge.RestAPI.DataService.ChapterDataService().UpdateChapter(id, chapter)); }
public Models.Chapter.Chapter Post([FromBody] Models.Chapter.Chapter chapter) { return(new BookOfKnowledge.RestAPI.DataService.ChapterDataService().CreateChapter(chapter)); }