public async Task <AuthorDTO> GetByIdAuthor(int id) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using RestService <AuthorDTO> restService = new RestService <AuthorDTO>(baseUrl); return(await restService.POSTAsync($"{webApi}{id}", null, false)); }
public async Task <bool> DeleteAuthor(int id) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using RestService <bool> restService = new RestService <bool>(baseUrl); return(await restService.DELETEAsync(webApi)); }
public async Task <IEnumerable <AuthorListDTO> > GetAllAuthors() { string baseUrl = BaseRestService.GetConnectionStringByName(false); using RestService <IEnumerable <AuthorListDTO> > restService = new RestService <IEnumerable <AuthorListDTO> >(baseUrl); return(await restService.GETAsync(webApi)); }
public async Task <T> GetById(string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { return(await restService.POSTAsync(webApi, null, false)); } }
public async Task <IEnumerable <T> > GetAll(string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <IEnumerable <T> > restService = new RestService <IEnumerable <T> >(baseUrl)) { return(await restService.GETAsync(webApi)); } }
public async Task <T> Delete(string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { return(await restService.DELETEAsync(webApi)); } }
public async Task <bool> CreateAuthor(AuthorDTO author, bool isNewItem) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using RestService <bool> restService = new RestService <bool>(baseUrl); if (isNewItem) { return(await restService.POSTAsync(webApi, author, false)); } else { return(await restService.POSTAsync(webApi, author, true)); } }
public async Task <T> Create(T entity, bool isNewItem, string webApi) { string baseUrl = BaseRestService.GetConnectionStringByName(false); using (RestService <T> restService = new RestService <T>(baseUrl)) { if (isNewItem) { return(await restService.POSTAsync(webApi, entity, false)); } else { return(await restService.POSTAsync(webApi, entity, true)); } } }