public ActionResult Delete(int id, CoachDetail model) { var service = CreateCoachService(); service.DeleteCoach(id); TempData["Save Result"] = "your coach was fired"; return(RedirectToAction("Index")); }
public ActionResult AddCoach(CoachDetail coach) { writeToDB(coach); return(RedirectToAction("Coaches", "Home")); }
private void writeToDB(CoachDetail coach) { string insertQry = string.Format("INSERT INTO CoachDetails(CoachName, Comments) VALUES('{0}', '{1}')", coach.CoachName, "Comments about " + coach.CoachName); targetDB.Value.ExecuteNonQuery(insertQry); }