/// <summary> /// Update an anime /// </summary> /// <param name="anime"></param> public void Update(Anime anime) { var index = this.anime.FindIndex(a => a.ID == anime.ID); if (index != -1) this.anime[index] = anime; else throw new ArgumentException("AnimeNotFound"); }
public ActionResult CreateAnime(FormCollection form) { if (form["operation"] == "Add") { Anime newAnime = new Anime() { ID = ar.GetNextID(), Title = form["title"], Publisher = form["publisher"], Author = new Author(form["firstName"], form["lastName"]), Description = form["description"], Genre = (GenreEnum.Genre)Enum.Parse(typeof(GenreEnum.Genre), form["genre"]), Season = (SeasonEnum.Season)Enum.Parse(typeof(SeasonEnum.Season), form["season"]), ReleaseDate = Convert.ToDateTime(form["releaseDate"]), Rating = Convert.ToDouble(form["rating"]), Aring = Convert.ToBoolean(form["aring"]) }; ar.Insert(newAnime); } return Redirect("/Anime/ShowTable"); }
/// <summary> /// Add an anime /// </summary> /// <param name="anime"></param> public void Insert(Anime anime) { this.anime.Add(anime); }