예제 #1
0
        public ActionResult Edit(Player model)
        {
            if (ModelState.IsValid)
            {
                PlayerRepo.Update(model);
            }

            return RedirectToAction("Index", "Player");
        }
예제 #2
0
        public ActionResult Add(Player model)
        {
            if (ModelState.IsValid)
            {
                PlayerRepo.Add(model);
                this.HttpContext.Application["Players"] = PlayerRepo.GetList();
            }

            return RedirectToAction("Index", "Player");
        }
예제 #3
0
 public static void Update(Player player)
 {
     if (ConfigurationManager.ConnectionStrings["DefaultConnection"] != null)
     {
         using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
         {
             var sp = new SqlCommand("UpdatePlayer", con);
             sp.CommandType = CommandType.StoredProcedure;
             sp.Parameters.AddWithValue("ID", player.Id);
             sp.Parameters.AddWithValue("Name", player.Name);
             sp.Parameters.AddWithValue("Nickname", player.Nickname);
             sp.Parameters.AddWithValue("email", player.Email);
             con.Open();
             sp.ExecuteNonQuery();
         }
     }
 }