public static List <ItemModel> ConvertToAnimeModel(this List <string> lines) { List <ItemModel> output = new List <ItemModel>(); foreach (string line in lines) { string[] cols = line.Split(';'); AnimeModel p = new AnimeModel(); p.Title = cols[0]; p.Url = cols[1]; p.PictureUrl = cols[2]; p.PicFormat = int.Parse(cols[3]); p.Score = decimal.Parse(cols[4]); p.Year = int.Parse(cols[5]); p.Favourite = bool.Parse(cols[6]); p.Notes = cols[7]; p.ListGroup = cols[8]; p.Season = cols[9]; p.TotalEp = int.Parse(cols[10]); p.WatchedEp = int.Parse(cols[11]); p.Dubbed = bool.Parse(cols[12]); output.Add(p); } return(output); }
public void CreateAnime(AnimeModel model) { var mapper = MapHelper.Mapping <AnimeModel, Anime>(); Anime anime = mapper.Map <Anime>(model); this.repository.AddAndSave <Anime>(anime); }
public static void DeleteAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute($"DELETE FROM {TableName} WHERE Id = @Id", anime); } }
public static void DeleteAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("DELETE FROM Anime WHERE ID=@ID", anime); } }
public static void ImportAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("INSERT OR IGNORE INTO Anime (Title, Url, PictureUrl, PicFormat, Score, Year, Favourite, Notes, ListGroup, Season, TotalEp, WatchedEp, Dubbed) " + "VALUES (@Title, @Url, @PictureUrl, @PicFormat, @Score, @Year, @Favourite, @Notes, @ListGroup, @Season, @TotalEp, @WatchedEp, @Dubbed)", anime); } }
public static void SaveAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute($"INSERT INTO {TableName} (AnimeName, CurrentEpisode, TotalEpisodes, WatchStatus, Rating) " + "VALUES (@AnimeName, @CurrentEpisode, @TotalEpisodes, @WatchStatus, @Rating)", anime); } }
public static void UpdateAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("UPDATE Anime SET Title=@Title, Url=@Url, PictureUrl=@PictureUrl, PicFormat=@PicFormat, Score=@Score, Year=@Year, Favourite=@Favourite, " + "Notes=@Notes, ListGroup=@ListGroup, Season=@Season, TotalEp=@TotalEp, WatchedEp=@WatchedEp, Dubbed=@Dubbed WHERE ID=@ID", anime); } }
private void RemoveAnime(AnimeModel animeToRemove) { // Removes the selection from the SQLite database SQLiteDataAccess.DeleteAnime(animeToRemove); // Removes the selection from the bindable collection Animes.Remove(animeToRemove); NotifyOfPropertyChange(() => TotalAnimes); }
public ActionResult AddAnime(AnimeModel a) { if (ModelState.IsValid) { AnimeList.Add(a); return(RedirectToAction("Index")); } ; return(View("AddAnime")); }
public static void UpdateAnime(AnimeModel anime) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute($"UPDATE {TableName} SET " + "AnimeName = @AnimeName, " + "CurrentEpisode = @CurrentEpisode, " + "TotalEpisodes = @TotalEpisodes, " + "WatchStatus = @WatchStatus, " + "Rating = @Rating " + "WHERE Id = @Id", anime); } }
public void UpdateAnime(int id, AnimeModel model) { var anime = this.repository.FirstorDefault <Anime>(x => x.Id == id); if (anime == null) { throw new NullReferenceException(); } var mapper = MapHelper.Mapping <Anime, AnimeModel>(); anime = mapper.Map <Anime>(model); this.repository.UpdateAndSave(anime); }
public static void fill(DataGrid table, AnimeModel model) { table.AutoGenerateColumns = true; table.ItemsSource = (from tab in model.AsStringArraysList() select new { Nom = tab[0], Saison = tab[1], Année = tab[5], Langue = tab[7], Sous__Titres = tab[8], Episodes = tab[6] }); }
public void Run() { string content = string.Empty; string agifyURL = $"https://animechan.vercel.app/api/random"; using (var wc = new WebClient()) { content = wc.DownloadString(agifyURL); } AnimeModel anime = JsonSerializer.Deserialize <AnimeModel>(content); Console.WriteLine(); Console.WriteLine(@$ "Anime -- {anime.Anime}"); Console.WriteLine(@$ "Character -- {anime.Character}"); Console.WriteLine(@$ "Quote -- {anime.Quote}"); }
private void AddToAnimeList(AnimeModel animeToAdd) { // Saves the anime to the database // Sets the id of the anime to the database version // This ensures it has the correct id to delete or edit later if needed SQLiteDataAccess.SaveAnime(animeToAdd); animeToAdd.Id = SQLiteDataAccess.GetLastRecord().Id; // Inserts an anime in the first index of the bindable collection // This makes it appear at the top of the data grid _animes.Insert(0, animeToAdd); if (SortType != SortMethod.All) { SortAnimeByStatus(); } NotifyOfPropertyChange(() => TotalAnimes); }
public static void fill(ComboBox cbox, int kind, AnimeModel model, bool emptyRow) { if (kind < PROP_TYPE || kind > PROP_SUB) return; List<string> l = new List<string>(); if (kind == PROP_TYPE) foreach (Anime a in model) foreach (string type in a.Type.Split(';')) if (!l.Contains(type)) l.Add(type.Trim()); if (kind == PROP_LANG) foreach (Anime a in model) if (!l.Contains(a.Language)) l.Add(a.Language); if (kind == PROP_SUB) foreach (Anime a in model) if (!l.Contains(a.Sub)) l.Add(a.Sub); cbox.ItemsSource = l; if (emptyRow) l.Add(""); }
private async void ExecuteRunAddAnimeDialog(object o) { var view = new AddAnimeDialogView { DataContext = new AnimeModel() }; var result = await DialogHost.Show(view, "RootDialog"); // If the user clicks the accept button, returns true for the command parameter // Closes the dialog if cancel is pressed by returning false if (result.Equals(true)) { AnimeModel animeToAdd = new AnimeModel(); animeToAdd.AnimeName = view.AnimeName.Text; // Checks to see if the input is valid if (view.WatchStatus.SelectedItem != null) { animeToAdd.WatchStatus = view.WatchStatus.SelectedItem.ToString(); } if (int.TryParse(view.CurrentEpisode.Text, out int currentEpisode)) { animeToAdd.CurrentEpisode = currentEpisode; } if (int.TryParse(view.TotalEpisodes.Text, out int totalEpisodes)) { animeToAdd.TotalEpisodes = totalEpisodes; } animeToAdd.Rating = view.Rating.Value; // Adds the anime to the bindable collection and sql database AddToAnimeList(animeToAdd); } }
public void PutAnime(int id, [FromBody] AnimeModel model) { compositionService.UpdateAnime(id, model); }
public void PostAnime([FromBody] AnimeModel model) { compositionService.CreateAnime(model); }