コード例 #1
0
        public ActionResult Create(Shard shard)
        {
            if(ModelState.IsValid)
            {
                shard.Id = Guid.NewGuid();
                this.db.Shards.Add(shard);
                this.db.SaveChanges();
                return RedirectToAction("Index");
            }

            if(this.account.IsUserAdmin(this.account.GetLoggedInUserId()))
            {
                return View(shard);
            }
            else
            {
                return RedirectToAction("Dashboard", "Home");
            }
        }
コード例 #2
0
        public ActionResult Edit(Shard shard)
        {
            if(ModelState.IsValid)
            {
                this.db.Entry(shard).State = EntityState.Modified;
                this.db.SaveChanges();
                return RedirectToAction("Index");
            }

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