Example #1
0
        public ActionResult Insert(CompetitionModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the contact
                try
                {
                    S_Competition competition = new S_Competition();
                    competition.challengeid = model.challengeId;
                    competition.description = model.description;
                    competition.enddate     = model.EndDate;
                    competition.price       = model.price;
                    competition.startdate   = model.StartDate;

                    CompetitionManager.Insert(competition);

                    return(RedirectToAction("Competition", "Competition", new { id = competition.challengeid }));
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", "Fout");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }