public bool isValid() { bool RValue = true; if (toList.Where(x => x.DesignationName.ToLower() == DesignationName.ToLower() && x.Id != Id).Count() > 0) { RValue = false; } return(RValue); }
public void Update() { string strsql = "update Designation set " + "DesignationName= '" + DesignationName.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }