public IEnumerable <BookCategory> Get() { var GetAllBaseCategories = _awsomeDbOperation.GetData("GetAllBaseCategories"); List <BookCategory> bkct = new List <BookCategory>(); while (GetAllBaseCategories.Read()) { bkct.Add(GetBookCategory(Convert.ToInt32(GetAllBaseCategories["Id"]))); } return(bkct); }
public IEnumerable <Books> Get(int?categoryId = null) { if (categoryId != null) { return(GetAllBooksByCategory((int)categoryId)); } var GetAllBooks = _awsomeDbOperation.GetData("GetAllBooks"); List <Books> bk = new List <Books>(); while (GetAllBooks.Read()) { bk.Add(GetBook(Convert.ToInt32(GetAllBooks["Id"]))); } return(bk); }
//POST api/<AuthorsController> //[HttpPost] //public void Post([FromBody] string value) //{ //} //PUT api/<AuthorsController>/5 //[HttpPut("{id}")] //public void Put(int id, [FromBody] string value) //{ //} //DELETE api/<AuthorsController>/5 //[HttpDelete("{id}")] //public void Delete(int id) //{ //} protected Authors GetAuthor(int id) { var Author = _awsomeDbOperation.GetData("GetAuthorById", new SqlParameter[] { new SqlParameter("@Id", id) }); if (Author.Read()) { return(new Authors { Id = Convert.ToInt32(Author["Id"]), Name = Author["Name"].ToString(), Surname = Author["Surname"].ToString(), Biography = Author["Biography"].ToString() }); } return(null); }