Beispiel #1
0
        public ActionResult Create(Skill skill)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.Skill.AddObject(skill);
                    db.SaveChanges();
                    return RedirectToAction("Index", "Home");
                }
                catch (Exception)
                {
                    return RedirectToAction("Create", "Skill");
                    throw;
                }

            }

            return View(skill);
        }
Beispiel #2
0
 public ActionResult Edit(Skill skill)
 {
     if (ModelState.IsValid)
     {
         db.Skill.Attach(skill);
         db.ObjectStateManager.ChangeObjectState(skill, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(skill);
 }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Skill EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSkill(Skill skill)
 {
     base.AddObject("Skill", skill);
 }
Beispiel #4
0
 /// <summary>
 /// Create a new Skill object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="averageScore">Initial value of the AverageScore property.</param>
 public static Skill CreateSkill(global::System.Int32 id, global::System.String name, global::System.Double averageScore)
 {
     Skill skill = new Skill();
     skill.Id = id;
     skill.Name = name;
     skill.AverageScore = averageScore;
     return skill;
 }