private static bool ValidateResponse(Model.Response.BookResponse response)
 {
     if (!string.IsNullOrEmpty(response.message))
     {
         return(false);
     }
     return(true);
 }
 public static Model.Response.BookResponse Create(Model.Entities.BookEntity request)
 {
     Model.Response.BookResponse response = new Model.Response.BookResponse();
     try
     {
         var dataservice = new Connection.DbContext();
         List <Model.Entities.BookEntity> listBooks = dataservice.GetListByParameter <Model.Entities.BookEntity, object>("createBook_InsertCommand", request);
         response.bookEntity = listBooks;
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
 public static Model.Response.BookResponse GetAll()
 {
     Model.Response.BookResponse response = new Model.Response.BookResponse();
     try
     {
         var dataservice = new Connection.DbContext();
         List <Model.Entities.BookEntity> listBooks = dataservice.GetList <Model.Entities.BookEntity, object>("getBooks_SelectCommand");
         response.bookEntity = listBooks;
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
 public static Model.Response.BookResponse GetAll()
 {
     Model.Response.BookResponse response = new Model.Response.BookResponse();
     try
     {
         response = Data.BookData.GetAll();
         if (ValidateResponse(response))
         {
             response.code    = 100;
             response.message = "Success";
         }
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
 public ActionResult <Model.Response.BookResponse> GetBookById(Model.Request.BookRequest request)
 {
     Model.Response.BookResponse response = Business.BookBusiness.GetBookById(request);
     return(response);
 }
 public ActionResult <Model.Response.BookResponse> GetAll()
 {
     Model.Response.BookResponse response = Business.BookBusiness.GetAll();
     return(response);
 }