Esempio n. 1
0
 public ActionResult Save(DotASettings model)
 {
     //Repace the Tip with the edited Tip
     db.Settings = model;
     db.Save();
     db = DotADB.Load();
     return(Index());
 }
Esempio n. 2
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());
        }
Esempio n. 3
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());
        }
Esempio n. 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());
        }
Esempio n. 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());
        }
Esempio n. 6
0
 /// <summary>
 /// fill relationship objects (Hero1 and Hero2)
 /// </summary>
 /// <param name="db"></param>
 /// <returns></returns>
 public RelationshipViewModel FillRelationships(DotADB db)
 {
     Hero1 = db.Heroes.FirstOrDefault(h => h.ID == Hero1ID);
     Hero2 = db.Heroes.FirstOrDefault(h => h.ID == Hero2ID);
     return(this);
 }