public ActionResult DeleteConfirmed(int id)
        {
            CruisePlan cruisePlan = db.CruisePlans.Find(id);

            db.CruisePlans.Remove(cruisePlan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Day,Port,Departure,Arrival,CruiseId")] CruisePlan cruisePlan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cruisePlan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CruiseId = new SelectList(db.Cruises, "Id", "Name", cruisePlan.CruiseId);
     return(View(cruisePlan));
 }
        // GET: CruisePlans/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CruisePlan cruisePlan = db.CruisePlans.Find(id);

            if (cruisePlan == null)
            {
                return(HttpNotFound());
            }
            return(View(cruisePlan));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CruisePlan cruisePlan = db.CruisePlans.Find(id);

            if (cruisePlan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CruiseId = new SelectList(db.Cruises, "Id", "Name", cruisePlan.CruiseId);
            return(View(cruisePlan));
        }
Exemple #5
0
        public ActionResult Agenda(Agenda model)
        {
            Cruise     cruise   = db.Cruises.Include(m => m.cruisePlans).Include(m => m.cruiseArrangements).FirstOrDefault(m => m.Id == model.CruiseId);
            CruisePlan krstPlan = new CruisePlan();

            krstPlan.Day       = model.Day;
            krstPlan.Port      = model.Port;
            krstPlan.Departure = model.Departure;
            krstPlan.Arrival   = model.Arrival;
            krstPlan.cruise    = cruise;
            krstPlan.CruiseId  = model.CruiseId;
            db.SaveChanges();
            cruise.cruisePlans.Add(krstPlan);
            db.SaveChanges();
            return(RedirectToAction("Details", new { id = model.CruiseId }));
        }