예제 #1
0
        public ActionResult Index(FederationModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to save the bond
                try
                {
                    S_Federation federation = new S_Federation();
                    federation.information = model.Information;
                    federation.id          = model.Id;
                    federation.logo        = model.UrlLogo;

                    if (!FederationManager.FederationExistById(1))
                    {
                        FederationManager.Insert(federation);
                        TempData["message"] = "De bond is toegevoegd.";
                    }
                    else
                    {
                        FederationManager.Update(federation);
                        TempData["message"] = "De bond is bijgewerkt.";
                    }

                    return(RedirectToAction("index", "Bond"));
                }
                catch (Exception e)
                {
                    TempData["error"] = "Er is een fout opgetreden.";
                }
            }

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