public async void SaveReadBook(BooksMapViewModel _model) { var result = await new BookShelfService().PostBook(_model); if (result.Status == 1) { List <BookViewModel> _listBook = new List <BookViewModel>(); _listBook.Add(book); // BookViewModel _viewModel = new BookViewModel(); //_viewModel.BookId = _model.BookId; //_viewModel.BookStatus = BookStatus.WishList; var savedBooks = BookRepository.SaveBookList(_listBook, BookStatus.Read); if (savedBooks != null) { CustomToast.Show("Book successfully added to read list", true); this.ReloadList(this, (int)_model.BookId); } else { CustomToast.Show("Failed to add book to read list", false); this.ReloadList(this, 0); } } //this.ListReload(this, 0); }
//public async Task<InpowerResult> getAllBooks() //{ // InpowerResult resp = null; // try // { // resp = await _helper.Get<InpowerResult>(GlobalConstant.BookShelfUrls.getAllBooksUrl.ToString()); // return resp; // } // catch (Exception ex) // { // CrashReportService crashReport = new CrashReportService(); // CrashReportModel CR = new CrashReportModel(); // CR.Filename = "BookShelfService"; // CR.Eventname = "GetAllBooks"; // // CR.UserID = GlobalClass.UserID == null ? "0" : GlobalClass.UserID; // CR.ErrorMsg = ex.Message + ex.StackTrace; // await crashReport.SendCrashReport(CR, GlobalConstant.CrashUrl); // return resp; // } //} public async Task <InpowerResult> GetAllBooks(PaginationModel paginationModel) { BooksMapViewModel model = new BooksMapViewModel(); model.IsRead = paginationModel.Status; model.SkipRecords = paginationModel.SkipRecords; model.TakeRecords = paginationModel.TakeRecords; model.SearchText = (String.IsNullOrEmpty(paginationModel.SearchText)?"": paginationModel.SearchText); InpowerResult resp = null; try { resp = await _helper.Post <BooksMapViewModel>(model, GlobalConstant.BookShelfUrls.getAllBooksUrl.ToString()); return(resp); } catch (Exception ex) { CrashReportService crashReport = new CrashReportService(); CrashReportModel CR = new CrashReportModel(); CR.Filename = "BookShelfService"; CR.Eventname = "PostBook"; // CR.UserID = GlobalClass.UserID == null ? "0" : GlobalClass.UserID; CR.ErrorMsg = ex.Message + ex.StackTrace; await crashReport.SendCrashReport(CR, GlobalConstant.CrashUrl); return(resp); } }
public async void SaveBook(BooksMapViewModel _model) { var result = await new BookShelfService().PostBook(_model); if (result.Status == 1) { List <BookViewModel> _listBook = new List <BookViewModel>(); _listBook.Add(obitmobEvent); // BookViewModel _viewModel = new BookViewModel(); //_viewModel.BookId = _model.BookId; //_viewModel.BookStatus = BookStatus.WishList; var savedBooks = BookRepository.SaveBookList(_listBook, BookStatus.Read); if (savedBooks != null) { Toast.MakeText(this.context_read, "Book successfully added to read list", ToastLength.Long).Show(); this.ListReload(this, (int)_model.BookId); } else { Toast.MakeText(this.context_read, "Failed to add book to read list", ToastLength.Long).Show(); this.ListReload(this, 0); } } this.ListReload(this, 0); }
public void OnClick(View v) { BooksMapViewModel _model = new BooksMapViewModel(); _model.BookId = obitmobEvent.BookId; _model.IsRead = 1; _model.UserId = CommonHelper.GetUserId(); RemoveBook(_model); }
partial void BtnRemove_TouchUpInside(UIButton sender) { BooksMapViewModel _model = new BooksMapViewModel(); _model.BookId = book.BookId; _model.IsRead = 1; _model.UserId = CommonHelper.GetUserId(); RemoveBook(_model); }
public void OnClick(View v) { if (InternetConnectivityModel.CheckConnection(context, true)) { BooksMapViewModel _model = new BooksMapViewModel(); _model.BookId = obitmobEvent.BookId; _model.IsRead = 0; _model.UserId = CommonHelper.GetUserId(); SaveBook(_model); } }
partial void BtnWishList_TouchUpInside(UIButton sender) { if (InternetConnectivityModel.CheckConnection(true)) { BooksMapViewModel _model = new BooksMapViewModel(); _model.BookId = book.BookId; _model.IsRead = 0; _model.UserId = CommonHelper.GetUserId(); SaveWishListBook(_model); } }
public async Task <InpowerResult> UpdateBook(BooksMapViewModel model) { InpowerResult resp = null; try { resp = await _helper.Post <BooksMapViewModel>(model, GlobalConstant.BookShelfUrls.UpdateBookUrl.ToString()); return(resp); } catch (Exception ex) { CrashReportService crashReport = new CrashReportService(); CrashReportModel CR = new CrashReportModel(); CR.Filename = "BookShelfService"; CR.Eventname = "PostBook"; // CR.UserID = GlobalClass.UserID == null ? "0" : GlobalClass.UserID; CR.ErrorMsg = ex.Message + ex.StackTrace; await crashReport.SendCrashReport(CR, GlobalConstant.CrashUrl); return(resp); } }
public async void RemoveBook(BooksMapViewModel _model) { var result = await new BookShelfService().RemoveBook(_model); if (result.Status == 1) { BookViewModel _viewModel = new BookViewModel(); _viewModel.BookId = _model.BookId; _viewModel.BookStatus = BookStatus.Removed; var savedBooks = BookRepository.UpdateBook(_viewModel); if (savedBooks != null) { Toast.MakeText(context, "Book successfully removed", ToastLength.Long).Show(); this.ListReload(this, (int)_model.BookId); } else { Toast.MakeText(context, "Failed to remove book", ToastLength.Long).Show(); this.ListReload(this, 0); } } this.ListReload(this, 0); }
public async void SaveBook(BooksMapViewModel _model) { var result = await new BookShelfService().UpdateBook(_model); if (result.Status == 1) { BookViewModel _viewModel = new BookViewModel(); _viewModel.BookId = _model.BookId; _viewModel.BookStatus = BookStatus.Read; var savedBooks = BookRepository.UpdateBook(_viewModel); if (savedBooks != null) { Toast.MakeText(this.context_read, "Book successfully added to read list", ToastLength.Long).Show(); this.ListReloadRead(this.context_read, (int)_model.BookId); } else { Toast.MakeText(this.context_read, "Failed to add book to read list", ToastLength.Long).Show(); this.ListReloadRead("test", 0); } } // ListReloadRead("test", 0); }
public async void RemoveBook(BooksMapViewModel _model) { var result = await new BookShelfService().RemoveBook(_model); if (result.Status == 1) { BookViewModel _viewModel = new BookViewModel(); _viewModel.BookId = _model.BookId; _viewModel.BookStatus = BookStatus.Removed; var savedBooks = BookRepository.UpdateBook(_viewModel); if (savedBooks != null) { CustomToast.Show("Book successfully removed", true); this.ReloadList(this, (int)_model.BookId); } else { CustomToast.Show("Failed to remove book", false); this.ReloadList(this, 0); } } // this.ListReloadWishList(this, 0); }
public async void SaveBook(BooksMapViewModel _model) { var result = await new BookShelfService().UpdateBook(_model); if (result.Status == 1) { BookViewModel _viewModel = new BookViewModel(); _viewModel.BookId = _model.BookId; _viewModel.BookStatus = BookStatus.Read; var savedBooks = BookRepository.UpdateBook(_viewModel); if (savedBooks != null) { CustomToast.Show("Book successfully added to read list", true); this.ReloadList(this, (int)_model.BookId); } else { CustomToast.Show("Failed to add book to read list", true); this.ReloadList(this, 0); } } // ListReloadRead("test", 0); }