Ejemplo n.º 1
0
        public ActionResult New()
        {
            var model = new Phase();

            ViewBag.Error = false;

            return View(model);
        }
Ejemplo n.º 2
0
        public Phase Insert(Phase phase)
        {
            if (phase.Validate())
            {
                phase.PhaseID = ObjectId.GenerateNewId();
                WriteConcernResult result = Phases.Insert(phase, new MongoInsertOptions{ WriteConcern = WriteConcern.Acknowledged });

                if (result.Ok) { return phase; }
            }
            return null;
        }
Ejemplo n.º 3
0
        public bool Update(Phase model)
        {
            var phase = Phases.FindOneById(model.PhaseID);

            if (phase == null) { return false; }

            phase.Active = model.Active;
            phase.Complete = model.Complete;
            phase.PhaseName = model.PhaseName;
            phase.SpotPrice = model.SpotPrice;
            phase.SponsorPrice = model.SponsorPrice;

            WriteConcernResult result = Phases.Save(phase, new MongoInsertOptions { WriteConcern = WriteConcern.Acknowledged });
            return result.Ok;
        }
Ejemplo n.º 4
0
        public ActionResult New(Phase model)
        {
            ViewBag.Error = true;

            if (ModelState.IsValid)
            {
                Phase result = Context.Phases.Insert(model);

                if (result != null)
                {
                    return RedirectToAction("Edit", new { id = result.PhaseID });
                }
            }

            return View(model);
        }