Ejemplo n.º 1
0
        public ActionResult Create(Weather weather)
        {
            if (ModelState.IsValid)
            {
                db.Frames.Add(weather);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.TemplateId);
            FillWeatherTypeSelectList();

            return View(weather);
        }
Ejemplo n.º 2
0
        //
        // GET: /Weather/Create
        public ActionResult Create()
        {
            Frame frame = TempData[FrameController.SelectorFrameKey] as Frame;

            if (frame == null || frame.PanelId == 0)
            {
                return RedirectToAction("Create", "Frame");
            }

            Weather weather = new Weather(frame, db);

            this.FillTemplatesSelectList(db, FrameTypes.Weather);
            FillWeatherTypeSelectList();

            return View(weather);
        }
Ejemplo n.º 3
0
        public ActionResult Edit(Weather weather, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(weather).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame");
            }

            this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.Frame.TemplateId);
            FillWeatherTypeSelectList();

            weather.Frame = frame;

            return View(weather);
        }