Пример #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,BushoName")] Busho busho)
        {
            if (id != busho.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(busho);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BushoExists(busho.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(busho));
        }
Пример #2
0
        /// <summary>
        /// デッキ追加イベント実行
        /// </summary>
        /// <param name="busho">
        /// 武将
        /// </param>
        public void SetDeckExecute(Busho busho)
        {
            if (this.MainDeck.DeckedBushos.Count >= 4)
            {
                if (this.SelectedPartyMemberIndex >= 0 && !this.MainDeck.IsContain(busho))
                {
                    int index = this.SelectedPartyMemberIndex;
                    this.MainDeck.Remove(this.SelectedPartyMemberIndex);
                    this.MainDeck.Add(busho, index);
                    this.SelectedPartyMemberIndex = index;
                    this.RaisePropertyChanged("SelectedPartyMemberIndex");
                }
                return;
            }

            if (busho == null)
            {
                return;
            }

            this._mainDeck.Add(busho);
            string[] keys = { "Busho1", "Busho2", "Busho3", "Busho4" };
            foreach (string key in keys)
            {
                this.RaisePropertyChanged(key);
            }

            this.RaisePropertyChanged("MainDeck");
        }
Пример #3
0
        public ActionResult DeleteConfirmed(long id)
        {
            Busho busho = db.Bushoes.Find(id);

            db.Bushoes.Remove(busho);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #4
0
 public ActionResult Edit([Bind(Include = "Id,BushoName")] Busho busho)
 {
     if (ModelState.IsValid)
     {
         db.Entry(busho).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(busho));
 }
Пример #5
0
        public async Task <IActionResult> Create([Bind("Id,BushoName")] Busho busho)
        {
            if (ModelState.IsValid)
            {
                _context.Add(busho);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(busho));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "Id,BushoName")] Busho busho)
        {
            if (ModelState.IsValid)
            {
                db.Bushoes.Add(busho);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(busho));
        }
Пример #7
0
        // GET: Bushoes/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Busho busho = db.Bushoes.Find(id);

            if (busho == null)
            {
                return(HttpNotFound());
            }
            return(View(busho));
        }