// GET: /Store/Browse?genre=Rock public ActionResult Browse(string genre) { //return "Hello from Store.Browse()"; //return HttpUtility.HtmlEncode("Store.Browse, Genre = " + genre); var genreModel = new Genre {Name = genre}; return View(genreModel); }
public ActionResult Create(Genre genre) { if (ModelState.IsValid) { storeDB.AddToGenres(genre); storeDB.SaveChanges(); return RedirectToAction("Index"); } return View(); }
public IHttpActionResult Post([FromBody]GenreDataModel model) { if (!this.ModelState.IsValid) { return this.BadRequest(this.ModelState); } var genre = new Genre { Name = model.Name }; this.data.Genres.Add(genre); this.data.Savechanges(); return this.Created(this.Url.ToString(), genre); }
/// <summary> /// Create a new Genre object. /// </summary> /// <param name="genreId">Initial value of the GenreId property.</param> /// <param name="name">Initial value of the Name property.</param> public static Genre CreateGenre(global::System.Int32 genreId, global::System.String name) { Genre genre = new Genre(); genre.GenreId = genreId; genre.Name = name; return genre; }
/// <summary> /// Deprecated Method for adding a new object to the Genres EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGenres(Genre genre) { base.AddObject("Genres", genre); }