Пример #1
0
        public ActionResult Create(Faction faction)
        {
            if(ModelState.IsValid)
            {
                faction.Id = Guid.NewGuid();
                this.db.Factions.Add(faction);
                this.db.SaveChanges();
                return RedirectToAction("Index");
            }

            if(this.account.IsUserAdmin(this.account.GetLoggedInUserId()))
            {
                return View(faction);
            }
            else
            {
                return RedirectToAction("Dashboard", "Home");
            }
        }
Пример #2
0
        public ActionResult Edit(Faction faction)
        {
            if(ModelState.IsValid)
            {
                this.db.Entry(faction).State = EntityState.Modified;
                this.db.SaveChanges();
                return RedirectToAction("Index");
            }

            if(this.account.IsUserAdmin(this.account.GetLoggedInUserId()))
            {
                return View(faction);
            }
            else
            {
                return RedirectToAction("Dashboard", "Home");
            }
        }