public static Model.Response.LoginResponse Login(Model.Request.LoginRequest request) { Model.Response.LoginResponse response = new Model.Response.LoginResponse(); try { var dataservice = new Connection.DbContext(); List <Model.Entities.UserEntity> userEntity = dataservice.GetListByParameter <Model.Entities.UserEntity, object>("loginUser", request); response.userEntity = userEntity[0]; } catch (Exception ex) { response.code = 500; response.message = ex.Message; } return(response); }
public static Model.Response.AuthorResponse GetAll() { Model.Response.AuthorResponse response = new Model.Response.AuthorResponse(); try { var dataservice = new Connection.DbContext(); List <Model.Entities.AuthorEntity> listAuthors = dataservice.GetList <Model.Entities.AuthorEntity, object>("getAuthors_SelectCommand"); response.authorEntity = listAuthors; } catch (Exception ex) { response.code = 500; response.message = ex.Message; } return(response); }
public static Model.Response.AuthorResponse Create(Model.Entities.AuthorEntity request) { Model.Response.AuthorResponse response = new Model.Response.AuthorResponse(); try { var dataservice = new Connection.DbContext(); List <Model.Entities.AuthorEntity> listAuthors = dataservice.GetListByParameter <Model.Entities.AuthorEntity, object>("createAuthor_InsertCommand", request); response.authorEntity = listAuthors; } catch (Exception ex) { response.code = 500; response.message = ex.Message; } return(response); }
public static Model.Response.BookResponse GetBookById(Model.Request.BookRequest 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>("getBooksById_SelectCommand", request); response.bookEntity = listBooks; } catch (Exception ex) { response.code = 500; response.message = ex.Message; } return(response); }