public ActionResult Create([Bind(Include = "CategoryId,Name,Description")] Categories categories) { if (ModelState.IsValid) { db.Categories.Add(categories); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categories)); }
public ActionResult Create([Bind(Include = "UserId,Name,Email,Bio")] Users users) { if (ModelState.IsValid) { db.Users.Add(users); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(users)); }
public ActionResult Create([Bind(Include = "PortfolioId,Title,Description,UserId,CategoryId,Image,Imagedescription,pContent")] Portfolio portfolio) { if (ModelState.IsValid) { db.Portfolio.Add(portfolio); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "Name", portfolio.CategoryId); ViewBag.UserId = new SelectList(db.Users, "UserId", "Name", portfolio.UserId); return(View(portfolio)); }