//This code allows to create and save your data into database. public ActionResult Admin() { var db = new PetBoardingDataContext(); var f_message = db.PetBoarding.ToArray(); return(View()); }
public ActionResult Details(long id) { var db = new PetBoardingDataContext(); var f_message = db.PetBoarding.Find(id); return(View(f_message)); }
public ActionResult PetBoarding(long id) //This code is responsible for finding data from database and showing it on petboarding page that is stored in it. { var db = new PetBoardingDataContext(); var f_message = db.PetBoarding.Find(id); return(View(f_message)); }
// GET: PetBoarding public ActionResult Index() //This code is responsible for reading and storing data to database and showing it on a index page that is stored in it. { var db = new PetBoardingDataContext(); var f_message = db.PetBoarding.ToArray(); return(View(f_message)); }
public ActionResult Delete([Bind] Models.PetBoarding FMsg) { var db = new PetBoardingDataContext(); db.Entry(FMsg).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Details([Bind] Models.PetBoarding FMsg) { if (ModelState.IsValid) { var db = new PetBoardingDataContext(); db.Entry(FMsg).State = System.Data.Entity.EntityState.Unchanged; db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create([Bind] Models.PetBoarding FMsg) { if (ModelState.IsValid) { //Save to database FMsg.Date = DateTime.Now; FMsg.Approved = false; var db = new PetBoardingDataContext(); db.PetBoarding.Add(FMsg); db.SaveChanges(); return(RedirectToAction("Index")); } return(Create()); }