public ActionResult Create([Bind(Include = "CategoryID,Name")] Category category) { if (ModelState.IsValid) { db.Categories.Add(category); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Create([Bind(Include = "LocationID,Name")] Location location) { if (ModelState.IsValid) { db.Locations.Add(location); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(location)); }
public ActionResult Create([Bind(Include = "ReviewerID,Name,DateJoined,ReviewerImage,ReviewerBio")] Reviewer reviewer) { if (ModelState.IsValid) { reviewer.DateJoined = DateTime.Today; db.Reviewers.Add(reviewer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reviewer)); }
public ActionResult Create([Bind(Include = "ReviewID,Title,Rating,Author,PublishedDate,Content,CategoryID")] Review review) { if (ModelState.IsValid) { db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", review.CategoryID); return(View(review)); }
public ActionResult Create([Bind(Include = "ReviewID,ArriveDate,DepartDate,Comment,Clean,PetFriendly,Pool,OnSiteDining,HouseKeeping,Concierge,NearBeach,BeachMiles,NearMountain,MountainMiles,BikesAvailable,ManyBikes,CategoryID")] Review review) { if (ModelState.IsValid) { db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Location", review.CategoryID); return(View(review)); }
public ActionResult Create([Bind(Include = "ID,Location,Details,VacationDate,CategoryID")] Review review) { if (ModelState.IsValid) { db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", review.CategoryID); return(View(review)); }
public ActionResult Create([Bind(Include = "ReviewID,Name,ReviewedDate,StarRating,Comments,LocationID,CategoryID")] Review review) { if (ModelState.IsValid) { db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", review.CategoryID); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "Name", review.LocationID); return(View(review)); }
public ActionResult Create([Bind(Include = "ReviewID,Title,Date,ReviewImage,ReviewContent,CategoryID")] Review review) { if (ModelState.IsValid) { review.Date = DateTime.Today; db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", review.CategoryID); return(View(review)); }
public int SaveChanges() { return(_context.SaveChanges()); }