public IActionResult Add(AddCosmeticBagViewModel ViewCBag) { if (ModelState.IsValid) { CosmeticBag newBag = new CosmeticBag { Name = ViewCBag.Name }; context.CosmeticBags.Add(newBag); context.SaveChanges(); return(Redirect("/CosmeticBag/ViewCosmeticBag/" + newBag.ID)); } return(View(ViewCBag)); //pass in object so view has somethign to work with }
public IActionResult Add() { AddCosmeticBagViewModel ViewCBag = new AddCosmeticBagViewModel(); return(View(ViewCBag)); }