public static bool UpdateTelecomPoints(TelecomPoints telecomPoints)
        {
            try
            {
                using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[Connection.ConnectionName].ConnectionString))
                {
                    string sqlstmt = "UPDATE [dbo].[TelecomPoints] SET discount = @discount Where id = @id";

                    SqlCommand myCommand = new SqlCommand(sqlstmt, myConnection);
                    myCommand.CommandType = CommandType.Text;

                    myCommand.Parameters.AddWithValue("@discount", telecomPoints.DiscountPercent);
                    myCommand.Parameters.AddWithValue("@id", telecomPoints.Id);

                    myConnection.Open();

                    myCommand.ExecuteNonQuery();

                    myConnection.Close();
                }
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
        private static TelecomPoints FillDataRecord(IDataRecord myDataRecord)
        {
            TelecomPoints telecomPoints = new TelecomPoints();
            telecomPoints.Id = myDataRecord.GetInt32(myDataRecord.GetOrdinal("Id"));
            telecomPoints.MinPoints = myDataRecord.GetInt32(myDataRecord.GetOrdinal("minpoints"));
            telecomPoints.MaxPoints = myDataRecord.GetInt32(myDataRecord.GetOrdinal("maxpoints"));
            telecomPoints.DiscountPercent = myDataRecord.GetInt32(myDataRecord.GetOrdinal("discount"));

            return telecomPoints;
        }
 public ActionResult Edit(TelecomPoints points)
 {
     if (ModelState.IsValid)
     {
         bool retval = AdminManager.UpdateTelecomPoints(points);
         if (retval)
         {
             MvcApplication.SetMessage("Telecom Points updated Successfully.");
             return RedirectToAction("ViewTelecomPoints");
         }
         return View(points);
     }
     return View(points);
 }
 public static bool UpdateTelecomPoints(TelecomPoints telecomPoints)
 {
     return TelecomPointsDB.UpdateTelecomPoints(telecomPoints);
 }