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); }
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); }
/// <summary> /// Deprecated Method for adding a new object to the Skill EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSkill(Skill skill) { base.AddObject("Skill", skill); }
/// <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; }