Пример #1
0
 public ActionResult Save(DotASettings model)
 {
     //Repace the Tip with the edited Tip
     db.Settings = model;
     db.Save();
     db = DotADB.Load();
     return(Index());
 }
Пример #2
0
        // GET: Hero/Delete/5
        public ActionResult Delete(int id)
        {
            var hero = db.Heroes.FirstOrDefault(h => h.ID == id);

            if (hero == null)
            {
                throw new Exception("Hero not found.");
            }

            db.Heroes.Remove(hero);

            db.Save();
            db = DotADB.Load();
            return(Index());
        }
Пример #3
0
        // GET: Relationship/Delete/5
        public ActionResult Delete(int id)
        {
            var relationship = db.Relationships.FirstOrDefault(h => h.ID == id);

            if (relationship == null)
            {
                throw new Exception("Relationship not found.");
            }

            db.Relationships.Remove(relationship);

            db.Save();
            db = DotADB.Load();
            return(Index());
        }
Пример #4
0
        public ActionResult Edit(RelationshipViewModel model)
        {
            var relationship = db.Relationships.FirstOrDefault(h => h.ID == model.ID);

            if (relationship == null)
            {
                throw new Exception("Relationship not found.");
            }

            //Repace the Relationship with the edited Relationship
            db.Relationships.Remove(relationship);
            db.Relationships.Add(Casting.UpCast <Relationship, RelationshipViewModel>(model)); //the upcast prevents all the extra stuff from being saved

            db.Save();
            db = DotADB.Load();
            return(Index());
        }
Пример #5
0
        public ActionResult Edit(Hero model)
        {
            var hero = db.Heroes.FirstOrDefault(h => h.ID == model.ID);

            if (hero == null)
            {
                throw new Exception("Hero not found.");
            }

            //Repace the hero with the edited hero
            db.Heroes.Remove(hero);
            db.Heroes.Add(model);

            db.Save();
            db = DotADB.Load();
            return(Index());
        }